JNDI lookup help please-Bean to Bean callout locally in same oc4j container

Hi - I'm fairly new to oc4j/ejb coding - I'm trying to get a simple application running to show that our code can be run in local mode - here is the scenario:
- Bean A (our application bean) within Application A
- Bean B (customer-developed bean) within Application B
- Bean B calls Bean A
- Bean A + Bean B are different application instances in the same oc4j container
- Jsp (residing in ApplicationB) within the same oc4j container calling Bean B, which invokes Bean A
====
I get the following exception (classes renamed to match scenario):
javax.naming.NameNotFoundException: oracle.apps.applicationa.common.BeanA not found in anothercompany.applicationb.common.BeanB
[java] at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
[java] at com.oracle.naming.J2EEContext.lookup(J2EEContext.java:76)
[java] at com.evermind.server.ApplicationContext.lookupJavaCompEnv(ApplicationContext.java:265)
[java] at com.evermind.server.ApplicationContext.lookupJavaComp(ApplicationContext.java:132)
[java] at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:306)
[java] at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
- BeanA is part of application named "AppA" in server.xml
- BeanB is part of application named "AppB" in server.xml
- AppB has attribute 'parent="AppA"' in server.xml
- If I change the Jsp file (residing in AppB) to call BeanA directly in the jsp code it works with no JNDI error, but changing the jsp code back to calling BeanB (which then calls BeanA) will throw the NameNotFoundException
My Stateless Session Bean is very simple and I have tried not setting the context and setting the context. I'm thinking this is a very simple configuration issue, but have not been able to find the solution yet... I've tried playing with the setSessionContext method in the session bean but have had no luck and am not sure what to set the variables to or even if I'm in the correct method...
public void setSessionContext(SessionContext ctx) {   
if (verbose)
System.out.println("setSessionContext called");
Properties env = new Properties();
// tried all three context factories...
//env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationInitalContextFactory");
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationClientInitialContextFactory");
//env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
// not sure what url to put, if any
//env.put(Context.PROVIDER_URL, "ormi://localhost:23791/AppB");
env.put(Context.PROVIDER_URL, "ormi://localhost/AppB");
// tried with and without security principals... also tried sysadmin/sysadmin
env.put(Context.SECURITY_PRINCIPAL, "guest");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
// mProps is a local transient member var of type Properties
mProps = env;
// mCtx is a local transient member var of type SessionContext
mCtx = ctx;
(edit) additional info:
- all beans/classes are in the same classes directory; there are no jar files, so in application.xml the specified classpath is "classes" which includes both appA and appB classes
- I verified that if I point (appB) jsp directly to BeanA it works with the "parent" attribute set on appB in server.xml, and when I remove the "parent" attribute on appB in server.xml the jsp throws a NameNotFoundException
edit #2:
another interesting note is that the exception message says "oracle.apps.applicationa.common.BeanA not found in anothercompany.applicationb.common.BeanB"
and usually the naming error I see is:
"oracle.apps.applicationa.common.BeanA not found in appB"
(as with the case when I use a jsp to access appA beans without setting the parent application of appB to appA)
- also my j2ee/home/applications/appB/WEB-INF/web.xml includes the oracle.apps.applicationa.common.BeanA ejb-ref tag
any help is appreciated - thanks!
Message was edited by:
oleon

Hi Steve
thanks for the reply - I currently have the parent attribute set in server.xml which is why the jsp connection works, but for some strange reason the bean cannot connect to other bean...
my server.xml has something like...
<application name="appA" location="appA" auto-start="true"/>
<application name="appB" location="appB" parent="appA" auto-start="true"/>
(ok, the tags might be off because I'm not in front of my workstation looking at the xml file...)
on another interesting note, in the session bean for AppB I've tried searching for the ejb bean for app B (itself basically) with the default initial context and it cannot find its own bean within the same application... the message would be something like "NameNotFoundException: anothercompany.applicationb.common.BeanB not found in anothercompany.applicationb.common.BeanB"

Similar Messages

  • Javax.naming.LinkException  JNDI error Help please

    Hello All,
    I am trying my first bean on Weblogic 7 and can't seem to get the deployment descriptor correct. The home
    interface is, ObjectIDLocalHome and the full class name is com.oga.gserve.biz.oid.ObjectIDLocalHome. I am
    using the fully qualified class name so that I can do an EJBHomeFactory latter on.
    I have used the WLS console and see my bean in the JNDI tree I also used the following to find it:
    public static void loop(final Context ctx, final String name) throws Exception {
    try {
    String local;
    NamingEnumeration childrenOfNaming = ctx.list(name);
    while (childrenOfNaming.hasMore()) {
    NameClassPair ncPair = (NameClassPair) childrenOfNaming.next();
    System.out.print(ncPair.getName() + " (type ");
    System.out.println(ncPair.getClassName() + ")");
    if (name.length() > 0) {
    local = name + "." + ncPair.getName();
    } else {
    local = ncPair.getName();
    loop(ctx, local);
    } catch (javax.naming.CannotProceedException e) {
    // We are at a leaf, no more children.
    I find ObjectIDLocalHome as type javax.naming.LinkRef, as a leaf of com.oga.gserve.biz.oid
    So I know it exist!
    But why as a javax.naming.LinkRef?
    Now when I try the following:
    String cName = ObjectIDLocalHome.class.getName();
    ObjectIDLocalHome home = (ObjectIDLocalHome) ctx.lookup(cName);
    I get:
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: Unable to resolve
    'java:app.ejb/gs-ejbs.jar#ObjectID/local-home' Resolved: '' Unresolved:'java:app' ; remaining name
    'java:app.ejb/gs-ejbs.jar#ObjectID/local-home'
    What is wrong?
    It must be in one of the .xmls but I can't see it:
    weblogic-ejb-jar.xml
    <?xml version = '1.0'?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>ObjectID</ejb-name>
    <entity-descriptor>
    <pool>
    </pool>
    <entity-cache>
    <cache-between-transactions>False</cache-between-transactions>
    </entity-cache>
    <persistence>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>7.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-use>
    </persistence>
    <entity-clustering>
    </entity-clustering>
    </entity-descriptor>
    <transaction-descriptor>
    </transaction-descriptor>
    <enable-call-by-reference>True</enable-call-by-reference>
    <local-jndi-name>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>OIDServer</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>100</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    <stateless-clustering>
    </stateless-clustering>
    </stateless-session-descriptor>
    <transaction-descriptor>
    </transaction-descriptor>
    <reference-descriptor>
    <ejb-local-reference-description>
    <ejb-ref-name>ejb/ObjectIDLocalHome</ejb-ref-name>
    <jndi-name>com.oga.gserve.biz.oid.ObjectIDLocalHome</jndi-name>
    </ejb-local-reference-description>
    </reference-descriptor>
    <local-jndi-name>com.oga.gserve.biz.oid.OIDServerLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    ejb-jar.xml
    <?xml version = '1.0'?>
    <!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>OIDRecord</display-name>
    <enterprise-beans>
    <session>
    <description><Session Bean ( Stateless )></description>
    <display-name>OIDServer</display-name>
    <ejb-name>OIDServer</ejb-name>
    <local-home>com.oga.gserve.biz.oid.OIDServerLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.OIDServerLocal</local>
    <ejb-class>com.oga.gserve.biz.oid.OIDServerBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-local-ref>
    <description><The Entity Bean we get our ID cahce from.></description>
    <ejb-ref-name>ejb/ObjectIDLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.ObjectIDLocal</local>
    </ejb-local-ref>
    </session>
    <entity>
    <description><Entity Bean ( CMP )></description>
    <display-name>ObjectID</display-name>
    <ejb-name>ObjectID</ejb-name>
    <local-home>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.ObjectIDLocal</local>
    <ejb-class>com.oga.gserve.biz.oid.ObjectIDBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>ObjectIDBean</abstract-schema-name>
    <cmp-field>
    <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>blockSize</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>nextId</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
    <query>
    <query-method>
    <method-name>findAll</method-name>
    <method-params>
    </method-params>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ObjectIDBean AS o]]></ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ObjectIDBean o WHERE o.name = ?1]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>OIDServer</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>ObjectID</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    Thank you for any help,
    Brad

    Hello All,
    I am trying my first bean on Weblogic 7 and can't seem to get the deployment descriptor correct. The home
    interface is, ObjectIDLocalHome and the full class name is com.oga.gserve.biz.oid.ObjectIDLocalHome. I am
    using the fully qualified class name so that I can do an EJBHomeFactory latter on.
    I have used the WLS console and see my bean in the JNDI tree I also used the following to find it:
    public static void loop(final Context ctx, final String name) throws Exception {
    try {
    String local;
    NamingEnumeration childrenOfNaming = ctx.list(name);
    while (childrenOfNaming.hasMore()) {
    NameClassPair ncPair = (NameClassPair) childrenOfNaming.next();
    System.out.print(ncPair.getName() + " (type ");
    System.out.println(ncPair.getClassName() + ")");
    if (name.length() > 0) {
    local = name + "." + ncPair.getName();
    } else {
    local = ncPair.getName();
    loop(ctx, local);
    } catch (javax.naming.CannotProceedException e) {
    // We are at a leaf, no more children.
    I find ObjectIDLocalHome as type javax.naming.LinkRef, as a leaf of com.oga.gserve.biz.oid
    So I know it exist!
    But why as a javax.naming.LinkRef?
    Now when I try the following:
    String cName = ObjectIDLocalHome.class.getName();
    ObjectIDLocalHome home = (ObjectIDLocalHome) ctx.lookup(cName);
    I get:
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: Unable to resolve
    'java:app.ejb/gs-ejbs.jar#ObjectID/local-home' Resolved: '' Unresolved:'java:app' ; remaining name
    'java:app.ejb/gs-ejbs.jar#ObjectID/local-home'
    What is wrong?
    It must be in one of the .xmls but I can't see it:
    weblogic-ejb-jar.xml
    <?xml version = '1.0'?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>ObjectID</ejb-name>
    <entity-descriptor>
    <pool>
    </pool>
    <entity-cache>
    <cache-between-transactions>False</cache-between-transactions>
    </entity-cache>
    <persistence>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>7.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-use>
    </persistence>
    <entity-clustering>
    </entity-clustering>
    </entity-descriptor>
    <transaction-descriptor>
    </transaction-descriptor>
    <enable-call-by-reference>True</enable-call-by-reference>
    <local-jndi-name>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>OIDServer</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>100</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    <stateless-clustering>
    </stateless-clustering>
    </stateless-session-descriptor>
    <transaction-descriptor>
    </transaction-descriptor>
    <reference-descriptor>
    <ejb-local-reference-description>
    <ejb-ref-name>ejb/ObjectIDLocalHome</ejb-ref-name>
    <jndi-name>com.oga.gserve.biz.oid.ObjectIDLocalHome</jndi-name>
    </ejb-local-reference-description>
    </reference-descriptor>
    <local-jndi-name>com.oga.gserve.biz.oid.OIDServerLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    ejb-jar.xml
    <?xml version = '1.0'?>
    <!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>OIDRecord</display-name>
    <enterprise-beans>
    <session>
    <description><Session Bean ( Stateless )></description>
    <display-name>OIDServer</display-name>
    <ejb-name>OIDServer</ejb-name>
    <local-home>com.oga.gserve.biz.oid.OIDServerLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.OIDServerLocal</local>
    <ejb-class>com.oga.gserve.biz.oid.OIDServerBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-local-ref>
    <description><The Entity Bean we get our ID cahce from.></description>
    <ejb-ref-name>ejb/ObjectIDLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.ObjectIDLocal</local>
    </ejb-local-ref>
    </session>
    <entity>
    <description><Entity Bean ( CMP )></description>
    <display-name>ObjectID</display-name>
    <ejb-name>ObjectID</ejb-name>
    <local-home>com.oga.gserve.biz.oid.ObjectIDLocalHome</local-home>
    <local>com.oga.gserve.biz.oid.ObjectIDLocal</local>
    <ejb-class>com.oga.gserve.biz.oid.ObjectIDBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>ObjectIDBean</abstract-schema-name>
    <cmp-field>
    <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>blockSize</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>nextId</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
    <query>
    <query-method>
    <method-name>findAll</method-name>
    <method-params>
    </method-params>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ObjectIDBean AS o]]></ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ObjectIDBean o WHERE o.name = ?1]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>OIDServer</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>ObjectID</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    Thank you for any help,
    Brad

  • JNDI lookup of a Stateless Session bean from another stateless session bean

    Hi,
       I am working on SAP Netweaver. We have created a stateless session bean which is finally deployed as a webservice. From this stateless session bean we need to call another stateless session bean as a local reference.
        I have done the following.
    1. Added JNDI-Name to the ejb-j2ee-engine.xml.
    2. My lookup code is as follows
    Context context = null;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
    context = new InitialContext(env);
    Object ejbObj =     context.lookup("MyBean");
    But i get the NamingException .Here MyBean is the jndi-name provided in the ejb-j2ee-engine.xml.
    Can somebody tell me what i am doing wrong.
    Thanks
    Priya

    Hi,
        Thanks for your replies.I did as you had suggested.I added ejb-local-ref to the ejb-jar.xml and i provided ejb-ref as MyBean.
    My lookup code uses the string
    ctxt.lookup("localejbs\MyBean");
    But still i get Naming Exception.
    I tried something different yesterday.
    I changed the code to use
    InitialContext ctxt = new InitialContext();
    ctxt.lookup("localejbs/"+ pathfromJNDIRegistry);
    and this time i did not get Naming exception but i got RemoteException saying there was error loading the class.
    Is there something i need to add somewhere for the classloader to be able to find and load this class in the second scenario.
    Please suggest me which method to go for amongst the two and what is the missing information i need to add.
    Thanks
    Priya

  • JNDI lookup of stand alone Entity Bean?

    Hi,
    I am attempting to lookup an Entity EJB from within a web app that was deployed as a separate EJB Module. (As far as I understand, multiple web applications should be able to reference EJB's that are deployed independantly within their own EJB modules.)
    To verify this works, I am using the sample "simple CMP EJB" sample that is pacakged with the App Server install.
    First, I deployed the 'cmp-simpleEjb.jar' as a stand alone EJB-Module using the web admin tool. It loads/deploys with no problem.
    Next, I create my own simple web app, and include the following relevant code in my Servlet:
    InitialContext ctx = new InitialContext();
    Object obj = ctx.lookup("ejb/MyProduct");
    ProductHome pHome = (ProductHome)PortableRemoteObject.narrow(obj,ProductHome.class);
    My web.xml includes an ejb-ref:
    <ejb-ref>
    <ejb-ref-name>ejb/MyProduct</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>samples.ejb.cmp.simple.ejb.Product</home>
    <remote>samples.ejb.cmp.simple.ejb.ProductHome</remote>
    </ejb-ref>
    My sun-wevb.xml incudes an ejb-ref:
    <ejb-ref>
    <ejb-ref-name>ejb/MyProduct</ejb-ref-name>
    <jndi-name>ejb/MyProduct</jndi-name>
    </ejb-ref>
    When I deploy my web app and call the Servlet from a browser, an Excpetion is thrown with a message "null". Can anyone please help me understand what is going on here?

    I added the Remote/Home interfaces into my web app's /WEB-INF/lib folder (jar-ed up of course) and now the Servlet fails with the following stack trace:
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: java.lang.ClassCastException
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at com.etango.testejb.struts.HomeAction.perform(Unknown Source)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:444)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:123)
    [25/Mar/2003:23:27:32] WARNING ( 527): CORE3283: stderr: at org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:138)
    Are you supposed to package the Home/Remote interface classes with the web app if referencing a independantly deployed EJB?

  • Urgent help please : useBean: Duplicate bean name error

    hi,
    i am trying to add a record to data base and my bean name is
    DBConn. when i try instantiate it is giving error. help imm.
    code:
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="DConn" scope="request" class="src.DBConn" />
    <%
         try {
         ResultSet rsa;
         String sclName = request.getParameter("SclName");
         String sclMissing = request.getParameter("SclMissing");
         int intMeasure= Integer.parseInt(request.getParameter("SclMeasure"));
         String sclMeasure = "";     
         boolean     flag=false;
         switch(intMeasure) {
         case 0:     
              sclMeasure="O";
              break;
         case 1:
              sclMeasure="M";     
              break;
         case 2:
              sclMeasure="N";
              break;
         String RecValue[]= new String [3];
         RecValue[0]=sclName;
         RecValue[1]=sclMeasure;
         RecValue[2]=sclMissing;
         flag=DConn.Execute("SCAMI1", new String[] { RecValue[0], RecValue[1],RecValue[2]});
         if (flag) {
         catch(Exception e) {
              System.out.println(e);
    %>

    i am mention the same bean in this page and after this, when i press the add button, i will move for another html page and from that page it will go to the bean which is given error.
    Code: Page1:
    =============
    <html><head><title>JSP Page</title>
    <%@ page language="java" import="java.sql.*" session ="true" %>
    <script type="text/javascript" >
         function AddSubmit()
         document.OutCome.action = "OutAddScale.html";
         document.OutCome.submit();
         function openModHtml()
              window.open ("OutModScale.html");          
         function openDelHtml()
              window.open ("OutDelScale.html");          
         function getRecord(thecaller) {
              (thecaller.value);
    </script>
    </head>
    <body>
    <FORM name=OutCome method="GET" >
    <P align=center><STRONG><FONT color=#000000>Out Come</FONT></STRONG> </P>
    <INPUT id=btnAdd name=btnAdd type=button value=Add onclick ="AddSubmit()" style="HEIGHT: 24px; WIDTH: 65px">
    <INPUT id=btnMod name=btnMod type=submit value=Modify style="LEFT: 136px; TOP: 381px" > 
    <STRONG><FONT color=#000000> </FONT></STRONG>
    <INPUT id=btnDelete name=btnDelete onclick ="openDelHtml()" type=button value=Delete style="LEFT: 190px; TOP: 381px">
    <p></p>
    <!-- data base connection. ->
    <jsp:useBean id="DConn" scope="page" class="src.DBConn" />
    <%
         DConn.DBConnect("MSSql","sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:ews","sa","sakshi123");
         response.setContentType("text/html");
         ResultSet rsa;
         String PSId="";
         String CSId="";
         try {
    %>
         <Table border="1" width=400>
         <tr>
         <td><b>Select</b></td>
         <td><b>Scale</b></td>
              <td><b>Measure</b></td>
              <td><b>Missing</b></td>
              <td><b>Options</b></td>
         </tr>     
    <%
              rsa=DConn.getRs("SCAMS1",new String[]{""});
              while(rsa.next()) {
                   CSId=     rsa.getString("ScaleId");
                   String id= rsa.getString("ScaleId");
                   String name= rsa.getString("ScaleName");
                   String measure= rsa.getString("Measure");
                   int missing = rsa.getInt("Missing");
                   String label= rsa.getString("Label");
                   int sclIndex = rsa.getInt("ScaleIndex");
                   if (measure.equals("O")) {
                        measure="Ordinal";
                   }else if ( measure.equals("M") ) {
                        measure="Metric";
                   }else if ( measure.equals("N") ) {
                        measure="Nominal";
                   if (!CSId.equals(PSId)) {
                        PSId=CSId;
    %>
                   <tr >
                        <Td><Input Type="Radio" name ="RSel" id="RSel" value= <%= CSId %> onClick="return getRecord(this )" ></td>
                        <td> <%= name %></td>
                        <td> <%= measure %></td>          
                        <td> <%= missing %></td>
                        <td> <%= sclIndex %> - <%= label %></td>
                   </tr>
    <%                         
                   }else {
    %>     
                   <tr>
                        <td></td>
                        <td></td><td></td><td></td>
                        <td><%= sclIndex %> - <%= label %></td>
                   </tr>
    <%
                   }     // else condition close          
         }     // while loop
    %>
         </table>
    <%
         }catch(Exception e){
              System.out.println(e);
              // e.printStackTrace();
    finally{      
    %> </form></body></html>
    code page2:
    ============
    <HTML><HEAD><TITLE>Add Scale</TITLE>
    <script language=javascript src="..\JScript\Validation.js">     
    </script>
    <script language=javascript src="..\JScript\Common.js">     
    </script>
    </HEAD>
    <body >
    <FORM name=AddScale method="GET" >
    <P align=center><STRONG>Add Scale</STRONG></P>
    <FONT color=darkblue>Scale Name 
    </FONT>   
    <INPUT id=SclName name=SclName onkeypress="return validateCharKeyPress(event)" style="WIDTH: 160px; HEIGHT: 18px"><P>
    <FONT color=darkblue>Scale Measure </FONT>
    <SELECT id=SclMeasure name=SclMeasure style="LEFT: 105px; WIDTH: 92px; TOP: 96px; HEIGHT: 22px">
                        <OPTION selected>ORDINAL</OPTION>
                        <OPTION>NOMINAL</OPTION>
                        <OPTION>METRIC</OPTION>
                        </SELECT></P>
    <p><FONT color=darkblue>Scale Missing</FONT>  
    <INPUT id=SclMissing name=SclMissing onkeypress="return validateNumberKeyPress(event)" style="LEFT: 98px; WIDTH: 155px; TOP: 101px; HEIGHT: 19px" align=right></p>
    <HR>
    <P><FONT color=darkblue><STRONG> Scale Options</STRONG></FONT></P>
    <SELECT id=SelScaleOpt name=SelScaleOpt onClick="SelList()" onChange="SelList()" size=2 style="WIDTH: 313px; HEIGHT: 114px" >
    <OPTION selected>1=Male</OPTION>
    <OPTION >2=FeMale</OPTION>
    </SELECT> 
    <p><FONT color=darkblue>                        
    <INPUT id=btnUp name=btnUp type=button value=UP onclick="LstUp()" style="WIDTH: 45px; HEIGHT: 24px" >
    <INPUT id=btnDown name=btnDown type=button value=Down onclick="LstDown()" style="LEFT: 67px; TOP: 436px" > </FONT></p>
    <p><FONT color=darkblue>Scale Option    </FONT>
    <INPUT id=txtScaleOpt name=txtScaleOpt onkeypress="return validateCharKeyPress(event)" style="WIDTH: 152px; HEIGHT: 20px"></p>
    <p>  
    <INPUT id=SclOptAdd name=SclOptAdd type=button value=Add onclick="addToList()" style="WIDTH: 65px; HEIGHT: 24px"> 
    <INPUT id=btnMod name=button1 style="LEFT: 136px; TOP: 381px" type=button value=Modify onclick="ModToList()" >
    <INPUT id=SclOptRemove name=SclOptRemove type=button value=Remove onClick="DelList()" style="LEFT: 190px; TOP: 381px"></p>
    <HR>
    <P>         
    <INPUT id=SclOk name=Ok type=button value=Save OnClick="ChkFields()" style ="WIDTH: 64px; HEIGHT: 24px">
    <INPUT id=SclCan name=Cancel style="WIDTH: 64px; HEIGHT: 24px" type=reset value=Cancel></P>
    </FORM>
    </body>
    </HTML>
    code page3 in this page its giving error
    ====================================================
    it is saying
    <jsp:useBean id="DConn" scope="page" class="src.DBConn" />
    <%     
         try {
         ResultSet rsa;
         String sclName = request.getParameter("SclName");
         String sclMissing = request.getParameter("SclMissing");
         String sclMeasure= request.getParameter("SclMeasure");
         if (sclMeasure.equals("ORDINAL")) {
              sclMeasure="O";
         }else if (sclMeasure.equals("METRIC")) {
              sclMeasure="M";     
         }else if (sclMeasure.equals("NOMINAL")) {
              sclMeasure="N";     
         String RecValue[]= new String [3];
         RecValue[0]=sclName;
         RecValue[1]=sclMeasure;
         RecValue[2]= sclMissing;          
    flag=DConn.Execute("SCAMI1", new String[]{RecValue[0],RecValue[1],RecValue[2]});
         if (flag) {
              out.println("tru");
         }else {
              out.write("false");
         catch(Exception e) {
              System.out.println(e);
    %>

  • JNDI lookup in xml file

    I want to use JNDi lookup for DB. Where should i specify them. Rigtnow i have given the hibernate connections in persistance xml file with user name pwd etc. But i dont want to do this. I want to use JNDI lookup and configure my weblogic for the JNDI. What are the changes I need to make in the application context and persistance xml files. Pls help?
    my persistance .xml file looks like this,
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="jpaPersistance" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.ggg.jp.model.bo.individual</class>
    <exclude-unlisted-classes/>
    <properties>
    <property name="hibernate.archive.autodetection" value="class, hbm"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="hibernate.connection.password" value="test"/>
    <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
    <property name="hibernate.connection.username" value="test"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
    </properties>
    </persistence-unit>
    </persistence>
    Application context looks like this,
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <!-- <bean/> definitions here -->
    <context:annotation-config/>
    <bean id="demoDataServiceImpl" class="com.gg.jp.model.services.impl.DemoDataServiceImpl" />
    <bean id="recordGeneratorWebServiceHandler" class="com.gg.jp.webservice.RecordGeneratorWebServiceHandler">
    <property name="service" ref="demoDataServiceImpl"/>
    </bean>
    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="jpaPersistance"/>
    </bean>
         <tx:annotation-driven/>
         <bean id="transactionManager"
         class="org.springframework.orm.jpa.JpaTransactionManager" >
         <property name="entityManagerFactory" ref="entityManagerFactory"/>
         </bean>
         </beans>

    Me again!
    So I found that I can't do jndi lookup (NamingException) for the datasource as mentioned, in the init method.
    However, the very same jndi lookup was successful in the overridden authenticate method, called by oc4j when trying to authenticate the user.
    Go figure!
    TIA,
    - nik.

  • ClassCastException on ejb jndi lookup

    Hello,
    I try to get an standalone remote client to to connect to my stateless session bean:
    java.util.Properties props = new java.util.Properties();
    props.put("java.naming.provider.url", "181.205.12.19:50004");
    props.put("java.naming.factory.initial", "com.sap.engine.services.jndi.InitialContextFactoryImpl" );
    props.put("java.naming.security.authentication", "simple");
    props.put("java.naming.security.principal", "j2ee_admin");
    props.put("java.naming.security.credentials", "*****");
    jndiContext = new InitialContext(props);
    fetching of jndi context is fine, but once I try to lookup my home interface I get a class cast exception:
    home = (ToEdifactConverterHome) PortableRemoteObject.narrow(jndiContext.lookup ("sap.com/EdifactEar/ToEdifactConverterBean"), ToEdifactConverterHome.class);
    java.lang.ClassCastException
         at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
         at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
         at test.cceag.transform.TransformTester.setUp(TransformTester.java:74)
         at test.cceag.transform.TransformTester.main(TransformTester.java:48)
    The jndi lookup seems to return the bean implementation object, but not the home interface itself.
    Thanks for any hints
    Matthias

    Hi Matthias,
    i think the   guide
    "How to...EJB: Accessing EJB Applications Using JNDI"
    will help you to solve the ejb lookup problem:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0736159e-0301-0010-9ea4-c63d83d0797b
    good luck, Katharina

  • Snap to beat markers:  I'm using iMovie 11.  Trying to prepare short movie of holiday using 2 or 3 songs and snap to beat feature.  It worked great for first segment/song but I can't seem to get it to work for the second song.  Help please.

    I'm using iMovie to prepare a short holiday video.  Snap to beat markers worked great for the first song but doesn't seem to work when I try to extend my project with a second song and more video and stills.  I dragged in the song and marked the beats but when I bring in stils and video clips they just ignore the beat markers.  Can anyone help please.  Thanks.

    I am having the same issue. The first song and beat markers work great. I add a second song and set beat markers. When I add photos, the appear at random spots with random lengths. I haven't seen a pattern yet. Spent 30 minutes on this topic at my last 1:1 session in the store. No luck figuring it out.
    One work-around might be to create one song per project (so beat markers work), then combine the two (or more) projects. But I'm not sure if that's possible or how to do it.
    Thanks for any help on this.

  • How do I retrieve photos/data etc. from my iPhone 4 before a completely erasing restore! It'stuck on a "connect to iTunes" to restore screen!  Help please!!!

    I connected my iPhone 4 to my PC to sync all my new info to iTunes/PC, but it said it was not able to recognize it and needs to do a complete restore!  How do I retrieve photos from my iPhone 4 before a complete restore! It'stuck on a "connect to iTunes" to restore screen and won't do anything else!  I tried rebooting the phone (holding the top button and the home button and the SAME "connect to iTunes" screen comes up.  If I restore, I will lose ALL my unsynced photos, apps, and data from the past week (INCLUDING pics from a concert WITH band members!) Help please!  MAYDAY!  My prior backup does NOT contain these photos/apps/data! Ahh!!!!

    I am having the same problems as this person. I see that someone said there is no way to retrieve the pictures once it gets stuck in recovery mode.
    Then further along someone said that there are data retrieval methods except they have something to do with jail breaking a phone.
    My phone is already jail broken. It was kind of a gift from the company I work for- it was a fellow employees before. He jail broke it and then it was given to me. After I got it I activated the 4 and tried to back up everything. It didn't work and "Springboard" forced the phone into safety mode. So I could use it with the old dude's apps and my contacts. I made the mistake of using the phone for wedding dress shopping with a friend. I took tons of pictures.
    After this I found out the messages I was seeing meant it was jail broken. At&t said to force restore the phone - iTunes wouldn't recognize it in safety mode. I'm an idiot and didn't realize what this meant for my pictures. It didn't work (error 1611) - thankfully. Now it is stuck in recovery mode (iTunes icon and USB cable picture).
    Can I access that media in any way? It never suceeded restoring itself so is it still there? The phone is jail broken already so is there a method I can use?

  • Problem in JNDI lookup with Jdev JDEVADF_MAIN_GENERIC_061111.1900.4245

    I have a JMS topic defined in a standalone oc4j (11g) and I am doing a JNDI lookup on that from an application that runs in embedded oc4j of jdev. Look up fails but if I add the same topic in jms.xml of embedded oc4j, it starts to work fine. My point is topic name shouldn't be needed in jms.xml of embedded oc4j i.e. client side (topic is present in remote oc4j and rightly defined in jms.xml of that oc4j). I verified that by creating a command line java application and that one is able to do lookup on the same topic available in the standalone oc4j.
    I guess this problem is not specific to the label JDEVADF_MAIN_GENERIC_061111.1900.4245, it was there before also.
    Any pointers on what could be wrong when I run in JDev?
    Thanks,
    Vishal

    Please use the internal email distribution list jdev_us for 11 related questions.

  • Old Don needs help, please...

    I have a BEFW11S4 wireless.  Works fine for my wired PC.  Have a guest trying to access with his Mac G4 and it is not accepting the password even though it is recognizing my network...help, please!

    I am also facing the same issue with my mac computer ..... i tried using "$" sign before the network password .....it worked .....

  • My iphone 5 keeps on losing contact details and i am also having instances of old text messages being resent when I am actually sending newly written text messages help please?

    My iphone 5 keeps on losing contact details and i am also having instances of old text messages being resent when I am actually sending newly written text messages help please?

    My wife is having the same problems as a reciever. She works in a school as a teaching assistant and her teacher sends messages that are mixed with previous texts from ages ago.
    Can anyone shed some light on this problem or is it only her and this poster?
    2m42s

  • I have an Apple ipod that gets stuck on the first track of every album, can you help please?

    I have an Apple Ipod model MC 688. My problem is that every track played 'sticks' , if I forward it sticks on the next track, just plays the same one over and over.
    Very frustrating, can you help please?

    "Sticks"
    Do you mean the same song repeats? If so, turn off the repeat (1) song feature.

  • EJB JNDI access from app1 to app2 in same oc4j (standalone) 9.0.4

    I have two applications CatalogosWeb and WSCatalogosWeb both in the same instance of a 9.0.4 standalone OC4J. The first one implements a set of EJB's (both entity and session). In the second i have the EJB classes included int the "classes" directory.
    When I try to acces de EJB from the second application I get a ClassCastException.
    The source code is approximately:
    ic = new InitialContext(env);
    where env is>
    {java.naming.provider.url=ormi://localhost:23791/CatalogosWeb, java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory, java.naming.security.principal=admin, java.naming.security.credentials=welcome}
    later I try to access the EJB>
    Object objref = ic.lookup(jndiHomeName);
    Object obj = PortableRemoteObject.narrow(objref, className);
    When the PortableRemoteObject tries to "narrow" the class I get the ClassCastException.

    user496903 ,
    When you need to perform lookups within the same OC4J container, you don't use RMIInitialContextFactory. Instead, you should use the new InitialContext() constructor, that defaults the initial context factory property to (if my memory doesn't fail) ApplicationInitialContextFactory...
    Look for more info in the Oracle App Server EJB developer Guide,
    hope it helps
    RB

  • JNDI Lookup for EJB3 (Bean to Bean)

    Hi Forum,
    i've search the whole internet and two books but I could not find an answer that pleased me.
    I want to get a reference to an EJB3 by JNDI Lookup. With container managed dependency injection everything works fine but I have to do a little more generic way, thats why I want to work with JNDI Lookup.
    I have the following situation:
    At first I have a stateless bean
    @Local
    public interface Job {
         * run the job
         * @return true if the job executed without errors
        public boolean run(SchedulerConfig schedulerConfig ,JobContext context);
    @Local
    public interface AConcreteJobLocal extends Job {   
    //no more declarations
    @Stateless
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public class AConcreteJobBean implements AConcreteJobLocal {
    //implemented methods goes here | removed for better overview in the post
    } This is a typical declaration for a bunch of jobs I have. Every concrete job has it's own bean if it necessary in some way for you to know.
    So now I wanted to write a bean which returns me an bean instance via a JNDI lookup
    @Stateless
    public class JobJNDILookupBean implements JobJNDILookupLocal {
        Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
        public Job getJobBeanFromJNDIName(String jndiName) {
            Job job = null;
            try {
                Context c = new InitialContext();
                job = (Job) c.lookup("jndiName");
            } catch (NamingException ex) {
                Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
                logger.log(Level.SEVERE, "Bean not found", ex);
            return job;
    }When I call this method I always get a NameNotFoundException
    javax.naming.NameNotFoundException: JNDI_NAME_GOES_HERE not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
            at javax.naming.InitialContext.lookup(InitialContext.java:351)
            at com.vw.ais.dcl.timer.engine.JobJNDILookup.getJobBeanFromJNDIName(JobJNDILookup.java:46)
            at com.vw.ais.dcl.timer.engine.EngineBean.init(EngineBean.java:221)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
            at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
            at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
            at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
            at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
            at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:83)
            at $Proxy713.init(Unknown Source)
            at com.vw.ais.dcl.timer.SchedulerBean.runEngine(SchedulerBean.java:192)
            at com.vw.ais.dcl.timer.SchedulerBean.handleIncomingByTimer(SchedulerBean.java:171)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
            at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
            at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
            at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:2824)
            at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1401)
            at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:99)
            at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1952)
            at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.service(EJBTimerService.java:1948)
            at com.sun.ejb.containers.util.WorkAdapter.doWork(WorkAdapter.java:75)
            at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)I've tried I guess all combinations for the JNDI_NAME
    java:/comp/env/ejb/AConcreteJob
    java:/comp/env/ejb/AConcreteJobLocal
    java:/comp/env/ejb/AConcreteJobBean
    java:/comp/env/AConcreteJob
    java:/comp/env/full.package.and.Class.name
    this all without java:/comp/env
    etc.
    The only way it worked was when I added a annotation to the JobJNDILookupBean in this way
    @Stateless
    *@EJB(name="ejb/AConcreteJob",beanInterface=A.Interface.location)*
    public class JobJNDILookupBean implements JobJNDILookupLocal {
    }But this is not what I want to do. Thats why my question. How can I lookup a bean without annotate it in the bean which want to look it up???
    In other words whats wrong here
    @Stateless
    public class JobJNDILookupBean implements JobJNDILookupLocal {
        Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
        public Job getJobBeanFromJNDIName(String someJndiName) {
            Job job = null;
            try {
                Context c = new InitialContext();
                job = (Job) c.lookup("someJndiName");
            } catch (NamingException ex) {
                Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
                logger.log(Level.SEVERE, "Bean not found", ex);
            return job;
    }I hope you understand my question and more than this I hope some has the answer.

    Hi Zsom,
    Zsom wrote:
    One thing you need to keep in mind is that beans aren't instantiated every time you make a call to your EJB. You're right! But because the fact the beans are all stateless it doesn't matter. I don't want to get a new EJB at a lookup. If I get a reference to a bean which was used a million times before it is absolutely ok
    Zsom wrote:
    You might be gaining some time because the container can create new beans more quickly, but you are also looking up the beans before each call, which in the long run will be even more expensive.Mhm, I don't know if I understand you. Maybe I explain my process a little bit. I have a lot of different jobs in my application (JobDoThis, JobDoThat, JobFoo, JobBar). Every job has a own bean which keeps the business logic. Furthermore I have an job engine which is able to execute jobs which are configured to run and this engine can solve some dependencies (If JobFoo fails don't execute JobBar , and so on). When I build my engine I want to get a reference to a jobBean by jndi lookup which keeps the business logic and then call some method on it. This means that the lookup will only be called when I build a new engine. And because this doesn't happen so often performance is not so important. Furthermore if all jobs all configured to run the application needs sometimes more than 12 hours (depended from the amount of data) for one run (Start to End -> the application has a little script character), that's why performance as I said already is not so important.
    Zsom wrote:
    But it would be worth making some test, because to me it seems a bit like bad design.Yes it could be, but this was my first thought to instantiate a bean (or get a reference to an existing one) dynamically. I don't like this hard coded dependency injection. I mean it's great If you know at compiletime which beans you need. But because we don't know which beans we need it's a big overhead to inject them all by container and then use only 40 percent of the injected bean because for example only 40 of 100 jobs shall run.
    If there is another approach to get a reference dynamically which is better than this then I will try, no problem, but unfortunally I don't see another.

Maybe you are looking for