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.

Similar Messages

  • 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]

  • EJB; Drawbacks of local interfaces?

    Hi,
    Would be appreciated if some body could tell me what are the drawbacks of local interfaces?
    Thanks

    There is nothing said as to whether or not the local interfaces are available to Servlets if the web container is running in the same JVM as the EJB container, or at least nothing I could find in the EJB 2.0 or J2EE 1.3 specifications.
    I haven't taken the opportunity to find out, but my guess is that as long as the EJB local home entries are findable by the client code and the client code use the objects stored there, then it will work.
    ANyone have any direct experience with this or better yet, additional insight into this question from a standards perspective.
    Chuck

  • Accessing Local Interface EJB from Web Container Oracle App Server 9.0.4

    Hi,
    I am developing a struts based small application, which calls a EJB which uses Local Interface from Struts ActionClass.
    I am getting NameNotFoundException. The exact exception is s mentioned below.
    05/03/29 16:15:49 javax.naming.NameNotFoundException: LoginRSL not found
    The deployment descriptors are as mentioned below.
    =============
    ejb-jar.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <description>Session Bean ( Stateless )</description>
    <display-name>LoginRSL</display-name>
    <ejb-name>LoginRSL</ejb-name>
    <local-home>loginApp.model.LoginRHome</local-home>
    <local>loginApp.model.LoginL</local>
    <ejb-class>loginApp.model.LoginRSL</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    <relationships/>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>LoginRSL</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    orion-ejb-jar.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar>
    <enterprise-beans>
    <session-deployment name="LoginRSL"/>
    </enterprise-beans>
    </orion-ejb-jar>
    I also tried adding following code to web.xml
    web.xml
    <ejb-local-ref>
    <ejb-ref-name>LoginRSL</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>LoginRHome</local-home>
    <local>LoginL</local>
    <ejb-link>LoginRSL</ejb-link>
    </ejb-local-ref>
    It is quite evident that it is not able to lookup the JNDI name.
    Can someone throw light on this? If someone has working sample of this, can you mail it to [email protected]?

    Nipun,
    WebLogic and OC4J are not the same thing. That's like saying Oracle and SQL Server are the same thing -- or C++ and Java are the same thing.
    I recall a posting to a forum (don't remember if it was this one), where the poster was complaining that some feature of the application server he had previously used, was not supported by OC4J. Turned out that the feature he was referring to, contradicted the J2EE specification -- which is why it wasn't available in OC4J. In other words, he didn't like the fact that OC4J was more compliant with the J2EE specification than his "other" application server. Go figure!
    So, if you haven't already done so, I suggest you verify that this feature of WebLogic is something that complies with the J2EE specifications -- before expecting OC4J to support the same feature.
    And if it's not clear, from the specifications, then every vendor is free to implement this feature (or not).
    So if it turns out that WebLogic is a more appropriate application server for you -- then why not just stick with it (and forget the others)?
    Good Luck,
    Avi.

  • Local Interfaces in WebLogic 7.0 Not Faster Than Remote Interfaces?

    I was curious how much faster calling business methods in
    a stateless session EJB in WebLogic 7.0 would be through
    a local interface than calling the same business methods
    through a remote interface. I timed both ways of calling
    the same methods and much to my surprise the times were
    nearly identical. I double-checked that in one case I really
    used the local interface (using ejb-local-ref, local-jndi-name,
    local interfaces in source code). Does anybody (perhaps from
    BEA) have an explanation for this? By the way, I ran the
    same experiment with other J2EE application servers such
    as IBM's WebSphere 5 (Beta) and there was a tremendous
    performance difference between local and remote interface
    usage.
    Thanks,
    Reinhard

    "Reinhard Klemm" <[email protected]> wrote in message
    news:[email protected]...
    I appreciate your response and, at the same time, I am somewhat
    surprised about it. Here are the reasons for my surprise:
    1. Your response indicates that WebLogic uses RMI for
    EJB local method calls, i.e., even if the client is on the same VM.
    I would have assumed that WebLogic would bypass RMI in such
    a situation.That is not what I said. Local interfaces wont use rmi.
    But remote interfaces do better if the call is from the same VM. This is
    weblogic rmi optimization. Please see Rob's posting also.
    2. Other J2EE application servers fare a lot better. In one
    experiment, I timed WebLogic against WebSphere 5.0 Technology
    for Developers (i.e., WebSphere 5.0 Beta, which is expressly
    NOT for performance testing) and against the Sun Reference
    Implementation. Here are the numbers for calling business
    methods in a stateless session EJB through its local interface:
    WebLogic: 5.15 ms on the average
    WebSphere: 0.41 ms on the average
    Sun Reference Implementation: 0.11 ms on the average
    This indicates to me that both WebSphere and the Sun Reference
    Implementation are better optimized than WebLogic by excluding
    RMI when making local EJB calls.
    Reinhard
    "Maruthi Nuthikattu" <[email protected]> wrote in message
    news:<[email protected]>...
    Can you post some numbers so that we can visualize the difference.
    Please add the numbers with other J2EE appserver also.
    Otherwise top of my head, the reason is:
    Weblogic rmi is well optimized for the calls with in the same JVM andsame
    J2EE application.
    This could be the reason you are not seeing much difference.
    ..maruthi
    "Reinhard Klemm" <[email protected]> wrote in message
    news:[email protected]...
    I was curious how much faster calling business methods in
    a stateless session EJB in WebLogic 7.0 would be through
    a local interface than calling the same business methods
    through a remote interface. I timed both ways of calling
    the same methods and much to my surprise the times were
    nearly identical. I double-checked that in one case I really
    used the local interface (using ejb-local-ref, local-jndi-name,
    local interfaces in source code). Does anybody (perhaps from
    BEA) have an explanation for this? By the way, I ran the
    same experiment with other J2EE application servers such
    as IBM's WebSphere 5 (Beta) and there was a tremendous
    performance difference between local and remote interface
    usage.
    Thanks,
    Reinhard

  • 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

  • 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.

  • EJB 3.0 Session bean local interface NullPointerException

    I am trying a very simple test of a Stateless EJB 3.0 bean called from a servlet.
    The bean has a local interface, annotated with @Local. The bean implements that interface and is annotated with @Stateless.
    I have a servlet with a variable of the local interface type, annotated with @EJB. The servlet's doGet method invokes the bean's one method using that interface and it works fine.
    BUT if I put the same variable, annotated with @EJB into another class in the web container, it is not injected correctly and I get a NullPointerException on the variable. This class is in WEB-INF/classes with the servlet class, so I assume it is loaded by the same classloader.
    I don't understand why the servlet can instantiate the EJB local interface successfully but another class in the web container can't. I get the same result in OC4J standalone 10.1.3.1 and 10.1.3.3.

    Only managed classes like servlets, filters etc. will have context and EJB references injected into them, and only with servlet version 2.5. A work colleague found the answer in Debu Panda's blog:
    http://debupanda.blogspot.com/2006_10_01_archive.html#116184543992078773
    This behaviour appears to be part of the EJB 3.0 standard.
    The solution is to use JNDI lookup in the client class (POJO) and declare an ejb-local-ref in web.xml.

  • EJB Local Interfaces / javax.naming.NamingException

    Hi!
    I have tried to deploy a very simple (Hello World like)EJB-Application. It contains a simple stateless SessionBean (with local interfaces) and a JSP which is using the EJB.
    Opening the JSP i get the following error message:
    javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and no suitable instance found for the ejb-local-ref 'ejb/TesterEJB', an EJB matching it's ejb-link 'ejb-jar-ic.jar#TesterEJB' was found, but it contained an Entity, not a Session
    Here's my ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
         <display-name>oc4jJAR</display-name>
         <enterprise-beans>
              <session>
                   <display-name>TesterEJB</display-name>
                   <ejb-name>TesterEJB</ejb-name>
                   <local-home>oc4jtest.TesterHome</local-home>
                   <local>oc4jtest.Tester</local>
                   <ejb-class>oc4jtest.TesterBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <security-identity>
                        <description/>
                        <use-caller-identity/>
                   </security-identity>
              </session>
         </enterprise-beans>
         <assembly-descriptor>
              <method-permission>
                   <unchecked/>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getMessage</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getPrimaryKey</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getEJBLocalHome</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>LocalHome</method-intf>
                        <method-name>remove</method-name>
                        <method-params>
                             <method-param>java.lang.Object</method-param>
                        </method-params>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>remove</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>isIdentical</method-name>
                        <method-params>
                             <method-param>javax.ejb.EJBLocalObject</method-param>
                        </method-params>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>LocalHome</method-intf>
                        <method-name>create</method-name>
                        <method-params/>
                   </method>
              </method-permission>
              <container-transaction>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getMessage</method-name>
                        <method-params/>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    And here's my web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    <web-app>
         <display-name>oc4jWAR</display-name>
         <filter>
              <filter-name>TestFilter</filter-name>
              <display-name>TestFilter</display-name>
              <description/>
              <filter-class>oc4jtest.TestFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>TestFilter</filter-name>
              <url-pattern>*.jsp</url-pattern>
         </filter-mapping>
         <servlet>
              <servlet-name>test</servlet-name>
              <display-name>test</display-name>
              <jsp-file>/test.jsp</jsp-file>
         </servlet>
         <session-config>
              <session-timeout>30</session-timeout>
         </session-config>
         <welcome-file-list>
              <welcome-file>/test.jsp</welcome-file>
         </welcome-file-list>
         <ejb-local-ref>
              <ejb-ref-name>ejb/TesterEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <local-home>oc4jtest.TesterHome</local-home>
              <local>oc4jtest.Tester</local>
              <ejb-link>ejb-jar-ic.jar#TesterEJB</ejb-link>
         </ejb-local-ref>
    </web-app>
    What's wrong?
    Comments would be appreciated!
    Thanks!
    Peter
    PS: The application runs fine on Sun's Reference Implementation!

    Hi!
    I have tried to deploy a very simple (Hello World like)EJB-Application. It contains a simple stateless SessionBean (with local interfaces) and a JSP which is using the EJB.
    Opening the JSP i get the following error message:
    javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and no suitable instance found for the ejb-local-ref 'ejb/TesterEJB', an EJB matching it's ejb-link 'ejb-jar-ic.jar#TesterEJB' was found, but it contained an Entity, not a Session
    Here's my ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
         <display-name>oc4jJAR</display-name>
         <enterprise-beans>
              <session>
                   <display-name>TesterEJB</display-name>
                   <ejb-name>TesterEJB</ejb-name>
                   <local-home>oc4jtest.TesterHome</local-home>
                   <local>oc4jtest.Tester</local>
                   <ejb-class>oc4jtest.TesterBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <security-identity>
                        <description/>
                        <use-caller-identity/>
                   </security-identity>
              </session>
         </enterprise-beans>
         <assembly-descriptor>
              <method-permission>
                   <unchecked/>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getMessage</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getPrimaryKey</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getEJBLocalHome</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>LocalHome</method-intf>
                        <method-name>remove</method-name>
                        <method-params>
                             <method-param>java.lang.Object</method-param>
                        </method-params>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>remove</method-name>
                        <method-params/>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>isIdentical</method-name>
                        <method-params>
                             <method-param>javax.ejb.EJBLocalObject</method-param>
                        </method-params>
                   </method>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>LocalHome</method-intf>
                        <method-name>create</method-name>
                        <method-params/>
                   </method>
              </method-permission>
              <container-transaction>
                   <method>
                        <ejb-name>TesterEJB</ejb-name>
                        <method-intf>Local</method-intf>
                        <method-name>getMessage</method-name>
                        <method-params/>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    And here's my web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    <web-app>
         <display-name>oc4jWAR</display-name>
         <filter>
              <filter-name>TestFilter</filter-name>
              <display-name>TestFilter</display-name>
              <description/>
              <filter-class>oc4jtest.TestFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>TestFilter</filter-name>
              <url-pattern>*.jsp</url-pattern>
         </filter-mapping>
         <servlet>
              <servlet-name>test</servlet-name>
              <display-name>test</display-name>
              <jsp-file>/test.jsp</jsp-file>
         </servlet>
         <session-config>
              <session-timeout>30</session-timeout>
         </session-config>
         <welcome-file-list>
              <welcome-file>/test.jsp</welcome-file>
         </welcome-file-list>
         <ejb-local-ref>
              <ejb-ref-name>ejb/TesterEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <local-home>oc4jtest.TesterHome</local-home>
              <local>oc4jtest.Tester</local>
              <ejb-link>ejb-jar-ic.jar#TesterEJB</ejb-link>
         </ejb-local-ref>
    </web-app>
    What's wrong?
    Comments would be appreciated!
    Thanks!
    Peter
    PS: The application runs fine on Sun's Reference Implementation!

  • Unable to invoke local interfaces in EJB 2, SJSAS 9 environment

    Hi,
    I am unable to get SJSAS to register local interfaces for an BMP entity bean. I am new to entity beans, and am trying out a simple case using EJB 2.0 deployed on SJSAS 9. I even had tried setting source level to 1.4, but no luck.
    EJB looks ok, as it was verified successfully by netbeans 5. But, I could not find the bean registerd when I verified it through the JNDI Brownsing utiltiy in SJSAS.
    I get the error
    javax.naming.NameNotFoundException: AccountLocal not found
    I have provided ejb-local-ref in web.xml, as shown below
    <ejb-local-ref>
    <ejb-ref-name>NewAccountLocal</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>entity2.NewAccountLocalHome</local-home>
    <local>entity2.NewAccountLocal</local>
    </ejb-local-ref>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>ejbEntity2</display-name>
    <enterprise-beans>
    <entity>
    <display-name>NewAccountEB</display-name>
    <ejb-name>NewAccountBean</ejb-name>
    <local-home>entity2.NewAccountLocalHome</local-home>
    <local>entity2.NewAccountLocal</local>
    <ejb-class>entity2.NewAccountBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>entity2.AccountPK</prim-key-class>
    <reentrant>false</reentrant>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>NewAccountBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    sun-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 2.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_0-0.dtd">
    <sun-ejb-jar>
    <enterprise-beans>
    <ejb>
    <ejb-name>NewAccountBean</ejb-name>
    <jndi-name>NewAccountLocal</jndi-name>
    <bean-pool>
    <steady-pool-size>1</steady-pool-size>
    <resize-quantity>1</resize-quantity>
    <max-pool-size>3</max-pool-size>
    <pool-idle-timeout-in-seconds>60</pool-idle-timeout-in-seconds>
    </bean-pool>
    <bean-cache>
    <max-cache-size>10</max-cache-size>
    <resize-quantity>1</resize-quantity>
    <removal-timeout-in-seconds>360</removal-timeout-in-seconds>
    <victim-selection-policy>LRU</victim-selection-policy>
    </bean-cache>
    </ejb>
    </enterprise-beans>
    </sun-ejb-jar>
    Access code:
    Object obj = ctx.lookup("NewAccountLocal");
    entity2.NewAccountLocalHome accHome = (entity2.NewAccountLocalHome) obj;

    Use "java:comp/env/NewAccountBean" instead. The portion relative to java:comp/env must
    exactly match the value in the <ejb-ref-name> element. There is no automatic prepending of
    "ejb" to the context relative to java:comp/env.
    Of course you could also keep the code the same, but change the value of the ejb-ref-name
    to <ejb-ref-name>ejb/NewAccountBean</ejb-ref-name>
    All that matters is that the value relative to java:comp/env and what's in the ejb-ref-name are a match.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • [JNDI] problem to publish local interface

    I have a problem (same as OC4J AS), the remote interface work well, but I can't use the local interface:
    package be.starapic.test.ejb;
    import javax.ejb.Local;
    import javax.ejb.Stateless;
    @Stateless(name="mysession2", mappedName="mysession2")
    @Local(MySession2Local.class)
    public class MySession2Bean implements MySession2Local {
         public String sayHello2() {
              return "You are welcome :)";
    Can't find that Local interface when browsing JNDI tree, so I guest you, what must I do ??? I think it would work because I use mappedName, but won't work with local interface :(

    Hi,
    Are you implementing Windows Azure Pack [WAP] solution ?
    If so, then I would request to post your question once again on the Azure Pack Forum.
    http://social.msdn.microsoft.com/forums/azure/en-US/home?forum=windowsazurepack
    Regards,
    Mekh.

  • Using EJB Local Interface problem

    Hi to all
    I have got a problem in using Local EJB Interface in Weblogic , please attention to my description
    I use JDeveloper as IDE
    At first I create an Application in JDeveloper that has two projects that their names are Model and ViewContorller that first one contains my EJB and another contains my JSP page respectively
    The EJB code is :
    @Stateless(name="AliEJB001Bean")
    @Remote
    @Local
    public class AliEJB001Bean implements AliEJB001, AliEJB001Local {
    public AliEJB001Bean() {
    public String Hi(){
    return "Hi000";
    And its Local Interface code is :
    @Local
    public interface AliEJB001Local {
    String Hi();
    I deploy Model project to an EJB Jar file that its name is AliEE1ejb1.jar
    and I deploy the ViewContorller project to a WAR file that its name is AliEE1WebApp.war
    Now I add this tags to web.xml
    <ejb-local-ref>
    <ejb-ref-name>ali/testejb</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>model.AliEJB001Local</local>
    </ejb-local-ref>
    Then I deploy the Application to an EAR file by name AliEE1
    After those I run my JSP page witch calls the EJB in JDeveloper (through Local EJB Interface) , JDeveloper deploy my Application to the ItegratedWeblogicServer
    Ultimately the JSP can calls the EJB through Local Interface and use the Hi method and shows me the result but JDeveloper while compiles the application give me these Warnings :
    Warning: <May 15, 2011 9:02:52 AM PDT> <Error> <J2EE> <BEA-160187> <weblogic.appc failed to compile your application. Recompile with the -verbose option for more details. Please see the error message(s) below.>
    Warning: There are 1 nested errors:
    Warning: weblogic.servlet.internal.dd.compliance.ComplianceException: Element "<ejb-local-ref>" with ejb-ref-name "ali/testejb" must either specify a valid ejb-link element or have a corresponding ejb-reference-descriptor element in weblogic.xml with a valid jndi-name.
    Warning:      at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:74)
    Warning:      at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:80)
    Warning:      at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.validate(EJBRefsComplianceChecker.java:97)
    Warning:      at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.checkEJBLocalRef(EJBRefsComplianceChecker.java:47)
    Warning:      at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.check(EJBRefsComplianceChecker.java:39)
    Warning:      at weblogic.servlet.internal.dd.compliance.ComplianceUtils.checkCompliance(ComplianceUtils.java:48)
    Warning:      at weblogic.servlet.jsp.JspcInvoker.checkCompliance(JspcInvoker.java:145)
    Warning:      at weblogic.servlet.jsp.JspcInvoker.compile(JspcInvoker.java:198)
    Warning:      at weblogic.application.compiler.AppcUtils.compileWAR(AppcUtils.java:376)
    Warning:      at weblogic.application.compiler.WARModule.compile(WARModule.java:245)
    Warning:      at weblogic.application.compiler.flow.SingleModuleCompileFlow.proecessModule(SingleModuleCompileFlow.java:18)
    Warning:      at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:36)
    Warning:      at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    Warning:      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    Warning:      at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    Warning:      at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
    Warning:      at weblogic.application.compiler.WARCompiler.compile(WARCompiler.java:29)
    Warning:      at weblogic.application.compiler.flow.AppCompilerFlow.compileInput(AppCompilerFlow.java:112)
    Warning:      at weblogic.application.compiler.flow.AppCompilerFlow.compile(AppCompilerFlow.java:37)
    Warning:      at weblogic.application.compiler.Appc.runBody(Appc.java:198)
    Warning:      at weblogic.utils.compiler.Tool.run(Tool.java:158)
    Warning:      at weblogic.utils.compiler.Tool.run(Tool.java:115)
    Warning:      at weblogic.application.compiler.Appc.main(Appc.java:257)
    Warning:      at weblogic.appc.main(appc.java:14)
    According to the warning messages I wanna add <ejb-link> tag to the web.xml for resolving warnings I add the <ejb-link> like this:
    <ejb-local-ref>
    <ejb-ref-name>ali/testejb</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>model.AliEJB001Local</local>
    <ejb-link>AliEE1ejb1.jar#AliEJB001Bean </ejb-link>
    </ejb-local-ref>
    But when JDeveloper want deploy my application again it shows me this Error
    [09:29:59 AM] Redeploying Application...
    <May 15, 2011 9:29:59 AM PDT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1305476999381' for task '7'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'AliEE1ejb1.jar#AliEJB001Bean' declared in the ejb-ref or ejb-local-ref 'ali/testejb' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    >
    <May 15, 2011 9:29:59 AM PDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 9 task for the application 'AliEE1'.>
    <May 15, 2011 9:29:59 AM PDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'AliEE1'.>
    <May 15, 2011 9:29:59 AM PDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'AliEE1ejb1.jar#AliEJB001Bean' declared in the ejb-ref or ejb-local-ref 'ali/testejb' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    >
    [09:30:00 AM] #### Deployment incomplete. ####
    [09:30:00 AM] Remote deployment failed
    Do you know how I can solve this issue ?
    thanks

    Thank you so much
    I find out the solution
    I have to define my EJB in ejb-jar.xml like this
    <enterprise-beans>
         <session>
         <ejb-name>ReplicableSFSB2</ejb-name>
         <business-local>model2.AliEJB001Local</business-local>
         <business-remote>model2.AliEJB001</business-remote>
         <ejb-class>model2.AliEJB001Bean</ejb-class>
         <session-type>Stateless</session-type>
         </session>
    </enterprise-beans>
    And then I use the EJB name witch I defined in <ejb-name> tag in <ejb-link> tag of web.xml
    like this
    <ejb-local-ref>
    <ejb-ref-name>ali/testejb2</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>model2.AliEJB001Local</local>
    <ejb-link>Model2EJB.jar#ReplicableSFSB2</ejb-link>
    </ejb-local-ref>

  • Local Interface in weblogic-ejb-jar.xml file

    I used Local Interface in WLS 7.0, and specifies the jndi-name as
    <weblogic-enterprise-bean>
    <ejb-name>MailboxService</ejb-name>
    <jndi-name>ejb/MailboxServiceHome</jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>MailboxServiceLocal</ejb-name>
    <jndi-name>ejb/MailboxServiceLocalHome</jndi-name>
    </weblogic-enterprise-bean>
    When I migrate to WLS 8.1, I keep receiving warning messages like:
    "[java] WARNING: Warning from ejbc: <jndi-name> must be defined for a bean
    with remo
    te interface. 'RecognitionServiceLocal(Jar: C:\ebdev\dev\make\eb-ejb\..\..\dist\eb-ejb.j
    ar)' does not have a remote interface."
    What is wrong here?
    Thanks in advance.

    jndi-name is specified for a remote interface.
    local-jndi-name is specified for a local interface.
    thanks,
    Deepak Vohra
    "Andy yang" <[email protected]> wrote:
    >
    I used Local Interface in WLS 7.0, and specifies the jndi-name as
    <weblogic-enterprise-bean>
    <ejb-name>MailboxService</ejb-name>
    <jndi-name>ejb/MailboxServiceHome</jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>MailboxServiceLocal</ejb-name>
    <jndi-name>ejb/MailboxServiceLocalHome</jndi-name>
    </weblogic-enterprise-bean>
    When I migrate to WLS 8.1, I keep receiving warning messages like:
    "[java] WARNING: Warning from ejbc: <jndi-name> must be defined
    for a bean
    with remo
    te interface. 'RecognitionServiceLocal(Jar: C:\ebdev\dev\make\eb-ejb\..\..\dist\eb-ejb.j
    ar)' does not have a remote interface."
    What is wrong here?
    Thanks in advance.

  • How can I get a reference to the Local interface of a EJB 3 session?

    Hi,
    How can I get a reference to the Local interface of a EJB 3 session?
    My session implements both the local and remote interfaces, so in my client, when I look up the remote interface using the following code, I did get a reference
              processor = (IItemProcessorRemote)initialContext.lookup(IItemProcessorRemote.class.getName());but if I also look up the local interface in th eclient using this:
    processorLocal =(IItemProcessor)initialContext.lookup(IItemProcessor.class.getName());I got errors like the following, do you know why? Thanks a lot!
    Exception in thread "main" javax.naming.NameNotFoundException: sessions.IItemProcessor not found
         at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203)
         at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)
         at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
         at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:116)
         at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)

    BTW, findItemByTitle(String title) is a business method in my ItemProcessor session bean.
    public String findItemByTitle(String title) {
              AuctionItem item;
              String result = null;
              try {
                   Query query = entityManager
                             .createNativeQuery("SELECT i from AuctionItem i WHERE i.title LIKE : aTitle");
                   query.setParameter("aTitle", title);
                   item = (AuctionItem) query.getSingleResult();
                   result = item.toString();
              } catch (EntityNotFoundException notFound) {
              } catch (NonUniqueResultException nonUnique) {
              return result;
         }

  • EJB 3.0  Stateless Local Interface not found

    Using Jdeveloper 1.3 it looked that EJB 3.0 local stateless session EJB bean cannot be found using ejection or lookup. It works with a remote interface.
    Context context =new InitialContext();
    SessionEJB sessionEJB = (SessionEJB)context.lookup("SessionEJB");
    Is it a bug ?
    Thank You

    Using Jdeveloper 1.3 it looked that EJB 3.0 local stateless session EJB bean cannot be found using ejection or lookup. It works with a remote interface.
    Context context =new InitialContext();
    SessionEJB sessionEJB = (SessionEJB)context.lookup("SessionEJB");
    Is it a bug ?
    Thank You

Maybe you are looking for

  • How to prevent libraries from being default save location

    Scenario: Users start IE10 as a published Xenapp Application. From there, they should be able to save pages, etc, but only to a network drive. They have no access to the local computer. I've succeeded in removing network, Libraries and favorites from

  • What can I do about error codes 33487 and 33443 from FieldPoint​.

    I am using the AI-111 current module with FP 1600 network module. I checked all wiring and connections and I can't find what is causing the problem.

  • Transfering iTunes/iPod to a new computer

    Hello! I recently purchased a new PC and am trying to transfer all of my files from my old machine (Windows XP) to the new one (Windows Vista). I am wondering a few things... 1- is there a way to transfer my playlist names/content from my old compute

  • Camera raw CS2 and Leopard

    I have been using CS2 with Leopard.I upgraded from CS online with a download to CS2. My hard drive crashed. I was sent a link via email thru Adobe to download CS2 again. When I downloaded/installed the program, when opening Bridge the message I got w

  • Changing MobileMe account "From" address

    I've decided to consolidate all of my e-mail to my MobileMe account with the address [email protected] All's well except on my iPhone, where e-mails are sent from [email protected] In iPhone settings for my MobileMe account, the address is listed as