Local interfaces documentation/examples

i'm looking for good examples/documentation on using local interfaces
with weblogic (6.1).
i gave it a try and kept getting a class cast exception while trying to
cast the ic.lookup result to the localhome interface. something tells
me that some deployment descriptors weren't up to snuff perhaps. i'm
using stateless session beans one main bean trying to call others. i'm
also using xdoclet to generate all the interfaces, but not the
deployment descriptors. i've reverted to using remote interfaces for
the time being just to get it all working.
one specific question that i've been getting mixed answers on. for
ejb's to use local interfaces, do they need to be in the same jar/war?
all our beans are deployed as one bean per jar file. makes for lots of
descriptor files ;).
thanks!
~mark

none wrote:
i'm looking for good examples/documentation on using local interfaces
with weblogic (6.1).You might have a look at the bands example. You could also check out
http://learnweblogic.com/updates/webauction.zip
>
i gave it a try and kept getting a class cast exception while trying to
cast the ic.lookup result to the localhome interface. The best way to debug ClassCastExceptions is to print out the class name
and loader of each class.
Something like this:
Object h = ic.lookup("fooHome")
System.out.println("lookup returned "+h.getClass().getName());
System.out.println("loaded by "+h.getClass().getClassLoader());
System.out.println("Trying to cast into "
+FooHome.class.getClassLoader());
something tells
me that some deployment descriptors weren't up to snuff perhaps. i'm
using stateless session beans one main bean trying to call others. i'm
also using xdoclet to generate all the interfaces, but not the
deployment descriptors. i've reverted to using remote interfaces for
the time being just to get it all working.I'd suggest you check out EJBGen as well.
>
one specific question that i've been getting mixed answers on. for
ejb's to use local interfaces, do they need to be in the same jar/war?
all our beans are deployed as one bean per jar file. makes for lots of
descriptor files ;).Personally I'm not a big fan of 1 ejb per jar file. You can make local
calls between jars if they are packaged within the same ear.
-- Rob
>
thanks!
~mark

Similar Messages

  • Remote interface / Local interface

    Hi
    I would like to if its possible to avoid using remote interfaces completely and improve performance by using - JSP -> Servlet -> (local interface) Session bean -> Entity bean ???
    Let the client call from JSP which is sent to control servlet which uses local-interface to send the request to a session bean that may in turn interact with Entity bean ?
    Is there any specific guidelines regarding that ?
    Thanks
    Ramesh

    building thru ANT is much more helpful, fast and efficient(I personally haven't tried any tools for builing EARs...:-)....Check out the EAR task in the ANT documentation...it describes each of its option and you will also find the EXAMPLES which you can download and tweak according to your beans....

  • Remote and local interface on same ejb 3.0 bean instance

    Hi,
    Is it posible to get remote and local interface on same ejb 3.0 bean instance.
    For example get local interface of a bean and than pass it as remote to client.
    Both interfaces must operate on same bean instance.
    Thanks
    Zlaja

    yes. You can implement multiple interfaces on a single class, so you can add a local and a remote interface. One trick to avoid duplicate code is to simply make the remote interface extend the local interface; then you only have to add the @Remote annotation and you're done.
    For example get local interface of a bean and than pass it as remote to client.You don't pass an instances to a client, a client looks up a remote instance of the bean through JNDI.

  • Weblogic 10.3.2 EJB3 Local Interface in POJO/Helper classes

    Hi,
    I have a jar file containing all EJB's in application & some Helper classes. I want to access Local interfaces of EJBs in those helper classes. Is there any way I can do it? I've gone through Maxence Button & Jay SenSharma 's blogs about accessing Local interface. but it doesn't help. May be these two guys can help me more here.. My requirement is very simple. Just to access local interface in POJO/Helper classes that are in same JAR file as EJB's. I can't get reference with @EJB class level annotation as Helper classes are called independently from MBean services.. not from any EJB or Servlert.
    Please if anyone can tell me how do I get reference of local interfaces, that would be really good.
    my environment is
    Weblogic 10.3.2
    EJB3
    Regards,
    Prasad

    Hi,
    Just check ...If you want something like mentioned in the below Link with a complete Example:
    [http://jaysensharma.wordpress.com/2009/08/16/weblogic-10-3-ejb3-local-lookup-sample/|http://jaysensharma.wordpress.com/2009/08/16/weblogic-10-3-ejb3-local-lookup-sample/]
    Regards
    Jay SenSharma

  • EJB 3.0 local interface JNDI

    Hello
    I found some information that will probably help a lot of people having trouble with local interface not referenced in JNDI.
    You need to delacre each local interface in the web.xml.
         <ejb-local-ref>
              <ejb-ref-name>MappedNameInYourEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
    <local> yourLocalInterface
              </local>
         </ejb-local-ref>
    The weird thing about this is you don't need to do it when you use remote interface!! I would have thought Weblogic was smart enough to put your EJB in the JNDI when you declare @local on your interface!!
    Am I wrong with something here?
    When I read the EJB spec, it says you don't need to declare your EJB anywhere when you use annotation....
    If someone have an explanation I would be very happy to read about it!!!!
    Tanx

    Hi,
    In our current impl, we don't bind local business interface impl onto global jndi, this is because adding global JNDI binding for local EJB means every local business interface object must be bound into global JNDI, which will give rise to strange errors when accessing remotely or in different application context.
    On the other hand, you needn't add each local interface in the web.xml, you can use annotation through EJB link, which is the suggested way to use EJB local reference, for example:
    @Stateful(name="AccountManagementBean")
    public class AccountManagementBean
    @EJB(
    name="PersonBeanRef",
    beanName="PersonBean"
    Person person;
    @Stateless(name="PersonBean")
    public class PersonBean implements Person {
    In this example, AccountManagementBean has a local reference of PersonBean, the key is you should use beanName in @EJB, whose value is the ejb name of referenced EJB.

  • EXTREMELY URGENT!!  Last question on Local Interfaces

    Using Oracle9iAS 9.0.3
    Running on RedHat 8.0
    Trying to implement local interfaces to my entity bean. (Oracle9iAS Containers for J2EE for 9.0.3) provides an example for writing local interfaces.
    pg. 2-10 states:
    //The variable is specified in the assembly descriptor (META-INF/ejb-jar.xml)
    Object homeObject = context.lookup("java:comp/env/EmployeeLocalBean");
    but, if you look at the ejb-jar.xml they reference, it's as follows (pg. 2-12):
    <ejb-jar>
    <enterprise-beans>
    <session>
    <description>Session Bean Employee Example</description>
    <ejb-name>EmployeeBean</ejb-name>
    <home>employee.EmployeeHome</home>
    <remote>employee.Employee</remote>
    <local-home>employee.EmployeeLocalHome</local-home>
    <local>employee.EmployeeLocal</local>
    <ejb-class>employee.EmployeeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    Where does the EmployeeLocalBean name come from for the lookup?!
    Also, do I NEED to deploy BOTH remote and local interfaces to get my local interfaces to work? Another post on this forum had a problem where they couldn't view the configurations of the EJB because there were not remote interfaces available, but then later they said it was just a problem with the web-based Enterprise Manager.
    Please, can someone let me know if these questions are not interesting enough to the forum? Has nobody here ever implemented Local Interfaces on 9.0.3? Do I need to be posting these questions to a different forum? Please advise and I will take care to get my answers elsewhere if necessary.
    It's just that every resource I've looked at for Local Interfaces (which 9.0.3 CAN implement...right?!) has conflicting information and seems to have buggy implementations. Please....help!
    Thanks in advance!

    Strangely enough, I'm not aware of troubles with enviroment variables and JNDI lookup. There are some misunderstandings - compared to WLS, JNDI tree is different.
    Here is an example of Session EJB settings:
    <session>
    <description>Session Bean ( Stateless )</description>
    <display-name>XSLTransformerEJB</display-name>
    <ejb-name>XSLTransformerEJB</ejb-name>
    <local-home>com.ness.europe.integration.transformer.XSLTransformerEJBLocalHome</local-home>
    <local>com.ness.europe.integration.transformer.XSLTransformerEJBLocal</local>
    <ejb-class>com.ness.europe.integration.transformer.impl.XSLTransformerEJBBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
    <env-entry>
    <description>path to root transformatin file</description>
    <env-entry-name>config/RootTransformFile</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>/oracle/product/IAS903/j2ee/MwCezPassport/xslt/passport.xslt</env-entry-value>
    </env-entry>
    </session>
    Next, there is an MDB with reference to it:
    <message-driven>
    <description>Message Driven Bean</description>
    <display-name>PassportMDB</display-name>
    <ejb-name>PassportMDB</ejb-name>
    <ejb-class>com.ness.europe.integration.inbound.mdb.InboundMDBBean</ejb-class>
    <transaction-type>Bean</transaction-type>
    <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    <subscription-durability>Durable</subscription-durability>
    </message-driven-destination>
    <ejb-local-ref>
    <ejb-ref-name>ejb/XSLTransformerEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>com.ness.europe.integration.transformer.XSLTransformerEJBLocalHome</local-home>
    <local>com.ness.europe.integration.transformer.XSLTransformerEJBLocal</local>
    <ejb-link>XSLTransformerEJB</ejb-link>
    </ejb-local-ref>
    There is basically this piece of code to do lookup environment variable:
    String toRet = (String)this.initCtx.lookup("java:comp/env/config/" + paramName);
    (of course, the config prefix is our syntax)
    As for EJB lookup, this is used:
    final InitialContext context = new InitialContext();
    return (XSLTransformerEJBLocalHome)context.lookup("java:comp/env/ejb/XSLTransformerEJB");
    I didn't created those beans but I asked mate from my team and answer as to troubles was "no".
    Is the problem lies in "not hard coded" names of beans in lookup? We are not trying to get "env/ejb" but just straighforwardly EJB using its name.
    Myrra

  • How use a proxy consumer web service in ABAP Program with local interface

    I generate a proxy class based on a WSDL file.
    I want to use this class in an abap programm without a connection but using XML files in local.
    I see with the class CL_PROXY_LOCAL_ADAPTER that it is possible to execute without connection but for use this, it's necessary to use the method REGISTER.
    This method have two parameters : Class Name and Interface Name.
    Class name is the name of my proxy class, but I don't know how to find the interface name.
    I think that a local interface is needed to generate but I don't know how to generate in interface with entries in SPROXSIG table ?
    Could you help me ?

    Check out the following links to see if it meets your needs.. Has examples to call a ABAP proxy (that consumes a webservice) from ABAP program...
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/frameset.htm (webservices ->webservices toolset -> examples)
    http://help.sap.com/saphelp_dm40/helpdata/en/1a/b69d427cab0831e10000000a1550b0/frameset.htm

  • Deploying EJB with Local Interfaces.

    HI everybody
    I am trying example on EJB with LocalInterfaces with BMP.
    My bean without Local interface is deployed and working fine.
    Then i have changed Home & Remote interface code. Again i have deployed it . It is deployed but i am unable to Look Up.
    I am using J2SDKEE1.3 server & JDK1.3.
    I have changed both interface files as follow:-
    I have made my Home interface as :
    public interface RetrieveConditionHome extends javax.ejb.EJBLocalHome {
         public RetrieveCondition create(String SQL_WHERE_ID, String SQL_WHERE_NAME,
              String FROM_TABLE , String WHERE_CLAUSE , String LAST_UPD_USER_ID ,
              Date LAST_UPD_TMSTMP, int ROW_VERSION)
              throws CreateException;
    I have made my Remote interface as :
    public interface RetrieveCondition extends javax.ejb.EJBLocalObject {
         public String getSQLWHERENAME() ;
    -Viren

    In JMS tutorial : They have stated ejbCreateLocal method.
    I am not using this method in my Bean class. I am using general ejbCreate method as we normally do .
    I am really confused about these methods : ejbCreate & ejbCreateLocal.
    JMS Tutorial site (where they have used ejbCreateLocal):
    A J2EETM Application that Uses the JMS API with an Entity Bean
    java.sun.com/products/jms/tutorial/1_3-fcs/doc/j2eeapp3.html
    Viren

  • JBoss and local interfaces (JNDI)

    I'm trying to do simple example involving local interfaces on JBoss.
    There is Bar remote interface, which uses Foo, local interface. And the problem is - i cant locate Foo within Bar:
    ejb-jar.xml:
    <session>
    <ejb-name>BarEjb</ejb-name>
    </session>
    <entity>
    <ejb-name>FooEjb</ejb-name>
    </entity>To make FooEjb accessible for Bar via local interface, as manual says, i have to put additional reference in ejb-jar.xml for Bar:
    <ejb-local-ref>
         <ejb-ref-name>LocalFooEjb</ejb-ref-name>
         <ejb-ref-type>Entity</ejb-ref-type>
         <local-home>beans.FooHome</local-home>
         <local>beans.Foo</local>
         <ejb-link>FooEjb</ejb-link>
    </ejb-local-ref>But it doesnt change anything, JBoss maps Foo like this: "Bound EJB LocalHome 'FooEjb' to jndi 'local/FooEjb@13595063'", and
    public class  Bar ... {
    Object ref = context.lookup("LocalFooEjb");
    }resuluts in exception:
    "java.lang.RuntimeException: LocalFooEjb not bound ..."
    Question: how do i map local interfaces within JBoss to some human-readable and predictable name?
    Thanks for help.
    update:
    specifying JNDI names in jboss.xml does the trick, but i still dont understand why JBoss ignores local-ref element. So anyone who can explain is welcome.
    jboss.xml
    ...xml declaration..
    <jboss>
         <enterprise-beans>
              <session>
                   <ejb-name>StockListEjb</ejb-name>
                   <jndi-name>remote/StockListEjb</jndi-name>
              </session>
              <entity>
                   <ejb-name>StockEjb</ejb-name>
                   <local-jndi-name>local/StockEjb</local-jndi-name>
              </entity>
         </enterprise-beans>
    </jboss>Edited by: anykeyN on Jun 29, 2008 7:06 AM

    [skipped]

  • Using local interfaces for EJB (session bean)

    Hi,
    I�ve a question regarding when to use the Local interfaces(EJBLocal and EJBLocalHome) of a enterprise bean. I understand that calls to enterprise bean can be made locally if the client which is invoking is in the same JVM as that of EJB. I�ve written a web client (servlet) which is packaged in a EAR and this servlet is trying to invoke a session bean which is in a �different� EAR using local interfaces. Both the EARs have been deployed in a single server (websphere 6.0 server). It didn�t work for me this way�..If I package the servlet in the same EAR of session bean then it works fine.
    So is this to say that both EARs are not running on the same JVM? Or should it work even if the client and the session bean are in different EARs but in same server?
    Can anyone explain me the fundamentals behind this.
    Thanks in advance

    Local access is only portable within the same .ear. For example, the Java EE SDK and SUN's
    application servers have never supported local EJB access from a web/EJB component in a different
    .ear. One issue is that local access requires that both the caller and target EJB have the same
    classloader. By definition, different Java EE applications have distinct classloaders. In addition,
    in Java EE 5 persistence context propagation does not span applications, so it wouldn't work in the
    local case.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Local Interfaces Support in 9.0.2 Release 2?

    Does Oracle9iAS 9.0.2 Release 2 support Local Interfaces? The reference I found is as follows:
    from http://otn.oracle.com/tech/java/oc4j/htdocs/oc4j-how-to.html:
    Please note that some of the How-To's only work with later versions of Oracle9iAS Containers for J2EE. For example Oracle9iAS Containers for J2EE (9.0.2) does not support some aspects of the EJB 2.0 specification, so the Local Interfaces How-To will not work on version 9.0.3. However, do not take the list below as as a list of what features are supported in what version of Oracle9iAS Containers for J2EE. This is simply a list of which How-To has been built and tested with which version of Oracle9iAS Containers for J2EE.
    I assume first of all that they really mean to state "so the Local Interfaces How-To will not work on version 9.0.2". But the next sentence states that I should not use this list to show which features are supported and which are not. Does anyone have a definitive answer as this portion of the Oracle website does not seem to provide one?
    Thanks in advance as always!!!

    Never mind. Sorry for wastin' all your time. Further searching has verified that there is no support for local interfaces in Oracle 9iAS 9.0.2 Release 2.

  • Questions about EJB local interfaces - 9iAS 9.03

    Intro: I am new in developing EJB, and I am trying to build an example to verify that a stateless session bean with local interfaces is quite efficient.
    Q1: I have read that an application trying to access local interfaces of an EJB must run into the same JVM. Does it means that it should be deployed into the same OC4J instance as the servlet?
    Q2: I am using JDev 10g to build the EJB, with local and remote interfaces. Using the internal OC4J container, I can use the remote interfaces but not the internal one: an object of class "_Proxy1" is returned after the lookup (with the same name as given for the remote interface related call). Is it possible to access the local interface?
    Q3: My application architecture is already defined to split the business logic in two EJBs: one stateless session bean for volatile data and one entity bean for a global user list cache. Where can I find a working example (with source code, please) to be deployed on 9iAS that can validate my design?
    Q4: In many places, I read that CMP entity bean are easier to develop than BMP one. Is there any special consideration I should be aware of before implementing a CMP for my global user list cache?
    Thanks a lot, Dom.

    I have just read:
    I think the problem is that local interfaces can only by
    accessed through the same container, and JSP/Servlet's
    one is different from EJB's one, regardless of you many
    application server's instances do you have... Hope this
    is the answer...Is there anyone who know if it applies too to 9iAS?
    A+, Dom

  • Local Data AddressDoes not belong to any of this hosts local interfaces

    I'm facing this error when I try to run the Applet from a client that download the applet and try to connect to de ip address of the origin.
    When I run localy, there is no error!
    Example: On 10.1.0.2, I browse 10.1.0.1/transmitapplet.html, and the error:Local Data AddressDoes not belong to any of this hosts local interfaces occurs.
    On 10.1.0.1, I browse 10.1.0.1/transmitapplet.html and the applet run properly.
    Anybody knows what is the problem?

    Sorry, but I hadn't have this problem till last week. Then I tried out to run my Application as Applet...
    The problem is, that a applet is not allowed to read the local IP-Address. I've solved this a little bit strange, by using a dummy SessionManager:
    public String getLocalAddress() {
    String result = null;
    SessionAddress addr = null;
    RTPSessionMgr mngrSession = (RTPSessionMgr) RTPManager.newInstance();
    if (mngrSession != null) {
    SessionAddress sessAddr = new SessionAddress();
    // empty address will use standard IP
    try {
    mngrSession.initialize(sessAddr);
    addr = mngrSession.getLocalSessionAddress();
    catch (InvalidSessionAddressException e1) {}
    if (addr != null) {
    result = addr.getDataHostAddress();
    mngrSession.closeSession();
    mngrSession.dispose();
    return result;
    else return null;
    This method does not support multiple IP-addresses.

  • Local interfaces and WLS 7

    Hi *,
    does anybody know if localinterfaces work in WLS7 SP1?
    thanx,
    Yauheni

    Yes. my classes were inclueded in system CLASSPATH. but Sun spec says nothing about
    that local interfaces could work only in the application context. it says that restriction
    is that it could work only on the same JVM. so it looks very strange, isn't it? i
    will try to pack everything in ear and try it again.
    Thanx,
    Yauheni
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Yes, it looks like this is a problem. Your application used to work on 6
    because you
    added all your classes to the system classpath, right? And it sounds like
    in 7, local
    calls also depend on the application environment being set.
    Yauheni Prykhodzka <[email protected]> wrote:
    actually, may be that is the problem, we have no ear. we have a set ofjars with
    ejbs and a set of web applications, whci are not packed in war. couldit be a problem,
    when i use local interfaces?
    but spec says that local interface could be used inside a JVM. i thinkit should
    not play a role, if classloadres of ejb and component that use ejb aredifferent.
    is it true?
    Yauheni
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Do you mean that servlet, which is a part of a .war which is deployed
    in
    the
    same .ear with the EJB components fails to invoke EJB's using local interfaces?
    Yauheni Prykhodzka <[email protected]> wrote:
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Interesting. I guess that the problem will go away if you stop using
    startup
    classes
    (for example, use load-on-startup servlet instead to perform initialization
    steps).
    No. I get the same problem after weblogic started. If i try to use localinterfaces
    from another bean o servlet i get the same exception.
    Yauheni
    Yauheni Prykhodzka <[email protected]> wrote:
    Here is the exception, which i'm getting:
    <10.07.2002 11:43:55 CEST> <Emergency> <WebLogicServer> <000342> <Unableto init
    ialize the server: Fatal initialization exception
    Throwable: weblogic.t3.srvr.FatalStartupException: Can't start serverdue to sta
    rtup class failure IdGeneratorStartUp - with nested exception:
    [javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundExcept
    ion: remaining name: /app/ejb/dox.comp.IdGenerator.jar#IdGenerator/local-home];
    Link Remaining Name: 'java:app/ejb/dox.comp.IdGenerator.jar#IdGenerator/local-ho
    me']
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundExcept
    ion: remaining name: /app/ejb/dox.comp.IdGenerator.jar#IdGenerator/local-home
    <<no stack trace available>>
    --------------- nested within: ------------------
    weblogic.t3.srvr.FatalStartupException: Can't start server due to
    startup
    class
    failure IdGeneratorStartUp - with nested exception:
    [javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundExcept
    ion: remaining name: /app/ejb/dox.comp.IdGenerator.jar#IdGenerator/local-home];
    Link Remaining Name: 'java:app/ejb/dox.comp.IdGenerator.jar#IdGenerator/local-ho
    me']
    at weblogic.t3.srvr.StartupClassRunner$1.run(StartupClassRunner.java:95)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:721)
    at weblogic.t3.srvr.StartupClassRunner.run(StartupClassRunner.java:71)
    at java.lang.Thread.run(Thread.java:484)
    >
    The WebLogic Server did not start up properly.
    the JNDI name for local interface is IdGeneratorLocalHome. i use thisname for lookup.
    Thanx,
    Yauheni--
    Dimitri--
    Dimitri
    Dimitri

  • Cmp2.0 /local interface

    Hi! I'm trying to deploy the wrox ch16 sample on cmp2.0 and local interfaces and got the following error:
    java.lang.InstantiationException: local/local-home tag not supported in this version
    Does OC4J ver 9.0.2 supports the new cmp2/cmr and local interfaces?
    Thanks.

    Pedro -- Local interfaces were not available in v902 but they are available in the OC4J v903 Developer Preview. You can download this from OTN. Please start at http://otn.oracle.com/tech/java/oc4j/content_preview.html to find the download as well as updated documentation and more data about the J2EE compliant version of OC4J.
    Thanks -- Jeff

Maybe you are looking for