ClassCastException - While type casting Home object after EJB JNDI Lookup

Sun One Application Server throws a ClassCastException when I try to type cast Home object to it's respective interface type.
Here is the code ---
==============================================
Object obj = PortableRemoteObject.narrow( context.lookup( jndiName ), homeClass);
System.out.println("Remote Object - obj : "+obj);
if (obj != null) {
   System.out.println("obj.getClass().getName() : "+obj.getClass().getName());
   System.out.println("obj.getClass().getSuperclass() : "+obj.getClass().getSuperclass());
   Class[] interfaces = obj.getClass().getInterfaces();
   if (interfaces != null) {
      for (int count = 0; count < interfaces.length; count++) {
         System.out.println("interfaces[ " + count + " ].getName() : " + interfaces[ count ].getName());
}==============================================
The class name is dislpayed as the Stub class name.
While displaying the interfaces, the Home Interface name is displayed.
But later when I try to type cast it into Home Interface type, it throws a ClassCastException.
Can somebody please check this?

Please post the stack trace. Also, take a look at our EJB FAQ to make sure you're doing the
recommended lookup :
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

Similar Messages

  • To upload data into ODS while Type of DataStore Object is Direct update

    Hi Experts,
    How to upload data from flat file to ODS while Type of DataStore Object is
    "Direct Update"? Please explain step by step.
    Any useful answer will be rewarded with suitable points
    Thanks and Regards,
    Sapna

    Hi Sapna jha
    Jus Have a look @ the following
    <u><b><a href="http://help.sap.com/saphelp_nw04s/helpdata/en/a4/1be541f321c717e10000000a155106/frameset.htm">UPDATING DATA TO DIRCET DSO</a></b></u>
    Hope itz Helps..!
    Regards
    KISHORE M REDDY
    **Winners Don't Do Different things,They Do things Differently...!**
    > Hi Experts,
    >
    > How to upload data from flat file to ODS while Type
    > of DataStore Object is
    >  "Direct Update"? Please explain step by step.
    >
    > Any useful answer will be rewarded with suitable
    > points
    >
    > Thanks and Regards,
    > Sapna

  • EJB JNDI lookup port

    Hi,
    If my AS Java's port is 50000, then the ejb port is 50004. Is it possible to change the default EJB JNDI lookup port to eg, 55555?
    Thanks.
    Any help will be highly appreciated.
    - julius

    hi,
    in addition to above context
    this may be help full to u
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/a2/f9d7fed2adc340ab462ae159d19509/content.htm
    bvr

  • JAXB : ClassCastException while using generated java objects

    Hi,
    I am using JAXB for unmarshalling my xml to set of java objects. It is working but when i use one child object and cast it i am getting ClassCastException.
    java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
    My XSD
    ======
    <xsd:complexType name="EmployeeType">
    </xsd:complexType>
    <xsd:complexType name="EmployeeList">
         <xsd:sequence>
              <xsd:element name="Employee" type="base:EmployeeType" maxOccurs="unbounded"/>
         </xsd:sequence>
    </xsd:complexType>
    JAXB Binding
    ==========
    In Binding i am direct schema compiler to use ArrayList for EmployeeList.. as i want to use this as ArrayList.
    <jxb:bindings node="//xs:complexType[@name='EmployeeList']">
              <jxb:class ref="java.util.ArrayList"/>
    </jxb:bindings>
    Everything works well but when i extract element from EmployeeList (i.e. ArrayList) and try to type cast it to EmployeeType, getting following exception:
    java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
    so at the time of unmarshalling how jaxb will know about the type of child element and use accordingly.
    Any help would be greatly appreciated.

    Hi,
    Could you try outputting the class type of the object you are trying to cast?
    Check the class of the object. Say use object.class.getName().
    I used jaxb quite a long time ago but I believe it resolves the classes correctly.

  • ClassCastException while looking up RMI objects bound to weblogic.JNDI under WLS 6.1

    We deploy a servlet (in a single .war archive) establishing a RMI connection to
    an external Java object bound into weblogic JNDI (WLS 6.1).
    We get a ClassCastException on invoking JNDI lookup:
    Servlet failed with Exception>
    java.lang.ClassCastException: $Proxy67
         at com.thyssenkrupp.tks.tnt.admin.rmi.ClientServlet.init(ClientServlet.java:81)
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:698)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:641)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:586)
         at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:366)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:240)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Curiously we don't observe these problems when we include all the classes of the
    remote application in the classpath of the WebLogic Server. Actually we want to
    avoid including external classes in weblogic.classpath for (hot) deployment reasons.
    It also seems that problems don't occur when accessing the remote object from
    an independent client application.
    We expect this to be a classloader conflict within WLS 6.1
    Does anybody know a solution to our problems?
    Thanks for suggestions
    Andreas Koerner

    There was a similar bug that was supposedly fixed in WL 6.1 SP 2. I had
    filed a bug on this myself, and was given a patch for SP1, you should be
    able to ask for the patch for CR060416.
    Peter Mularien
    Deploy Solutions, Inc.
    Andreas Koerner wrote:
    >
    We deploy a servlet (in a single .war archive) establishing a RMI connection to
    an external Java object bound into weblogic JNDI (WLS 6.1).
    We get a ClassCastException on invoking JNDI lookup:
    Servlet failed with Exception>
    java.lang.ClassCastException: $Proxy67
    at com.thyssenkrupp.tks.tnt.admin.rmi.ClientServlet.init(ClientServlet.java:81)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:698)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:641)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:586)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:366)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:240)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Curiously we don't observe these problems when we include all the classes of the
    remote application in the classpath of the WebLogic Server. Actually we want to
    avoid including external classes in weblogic.classpath for (hot) deployment reasons.
    It also seems that problems don't occur when accessing the remote object from
    an independent client application.
    We expect this to be a classloader conflict within WLS 6.1
    Does anybody know a solution to our problems?
    Thanks for suggestions
    Andreas Koerner

  • 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

  • NamingException on EJB jndi lookup

    I have two applications - deployed under the "default instance".
    When I start up OC4J and deloy app1 and app2, then app1 can do a JNDI lookup on a session bean that resides in App2. It uses the RMIInitialContextFactory.
    Provider is "ormi://localhost/app2"
    My problem is that if I undeploy and redeploy app2, then app1 suddenly can't do a lookup to any sessionBean found in app2 anymore, even though the jndi name still shows up in the browser, and if I try to look it up from an external application running outside of oc4j (with exactly the same code as I'm using in app1), it also works.
    So why is app1 not able to find app2 via jndi after a redeployment?
    D

    Avi - thank you for your response.
    First of all, I run on Suse Linux 10.1. Dunno if that's any help, but hey, more info can't help :)
    Let's answer your questions:
    1.) OCJ4 Version: 10.1.3.0.0 (build 060119.1546.05277)
    2.) JDK Version: 1.5.0_07-b03
    As for your suggestions:
    1.) app1 = parent of app2.
    I'm rather new to Oracle, so maybe I made a mistake during my investigations. Still, I'd like to give a breakdown: I built a framework-type application, and thought about deploying "child modules" (plug-in applications) underneath it, as you proposed.
    This worked fine, but there comes a problem whenever you try to use something like Hibernate in any application that's not deployed in the root (ie any app that's deployed as a child of another). The problem came in 2 flavours:
    A) If you use a jar in the parent and try to do resource loading from the child, the context of the parent is used the whole time. Since the search-policy of the class-loader is loaded->parent->shared->local, and if Hibernate is already used in the parent, it never gets to the child and thus trying to load a resource in the child is futile since parent can't see child context.
    B) Lets say you're not using Hibernate at all in the parent application. When doing resource loading (eg the hibernate.cfg.xml file), Hibernate tries to locate the resource via Thread.currentThread().getContextClassLoader(). OC4J returns the parent-app's thread as the currentThread, NOT that of the child-application that you're actually running the code from, thus it will never be able to pick up resources from within a jar part of the child application. The only way that I managed to get it to work, was to include the Hibernate3.jar as part of the EAR deployment (ie listed it as <library path...> in the orion-application.xml. Putting it in shared-libs or app-libs didn't work...ever. Also, if I happened to use Hibernate in the parent-application, it doesn't matter if I put hibernate3.jar in the EAR of the child - the parent-version gets picked up and used due to the search-policy... NOTE: This is in a JAR - I'm not using WAR's so cannot force local loading as is possible with web-apps...
    I then opted to deploy applications seperately under the root, and using RMI to communicate from the framework-application to its "modules", and vice-versa. The master doesn't know the exact type of the remote interface of whatever child-module it needs to call, so it uses reflection to call the "create" on the EJBHome of whatever child-module it needs to invoke as well as the method on the actual remote-interface.
    Please note, if I deploy both applications (master and child), and perform JNDI lookups from master to child, it works perfectly. As soon as I do a redeploy (or explicity undeploy, deploy), JNDI fails. External clients, though, works all the time. Also, if I redeploy the child before ever calling it from the parent-application, it also works after I did redeployment. It's as if, when you do a JNDI lookup the first time, it caches something and from there on it breaks if you do a redeploy and perform a consequent app-to-app JNDI lookup...
    2.) dedicated.rmicontext=true
    I tried this by setting it as a JNDI property before getting the InitialContext - makes no difference, unfortunately.
    //========CODE============================
    // This is in a SessionBean inside the Master Application. For the time being I've hard-coded the provider-url of the client-application.
    // NOTE: This EXACT same code is used in the external java client - there it works perfect every time, whether I redeploy or not.
    //========================================
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://localhost/client-application");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "MyPassword");
    env.put("dedicated.rmicontext","true");
    InitialContext ctx = null;
    try {
         ctx = new InitialContext(env);
         // WHEN I REDEPLOY, CODE CRASHES ON THE NEXT LINE
         Object home = ctx.lookup("ejb/TestWorkerAProxyBean");
         EJBHome obHome = (EJBHome) PortableRemoteObject.narrow(home, EJBHome.class);
         System.out.println("EJBHOME Is [" + obHome + "]");
         final Object invocationTarget = MethodUtils.invokeExactMethod(obHome,"create",new Object[0]);
         System.out.println("invocation target = [" + invocationTarget + "]");
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
         IWorkerProxy proxy = (IWorkerProxy)Proxy.newProxyInstance(classLoader, new Class[]{IWorkerProxy.class}, new InvocationHandler() {
              public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                   try {
                        Method remoteEjbMethod = invocationTarget.getClass().getMethod(method.getName(),method.getParameterTypes());
                        return remoteEjbMethod.invoke(invocationTarget, args);
                   } catch (Exception e) {
                        ExceptionHandler.handle(e);
                   return null;
    } catch (NamingException ne) {
         System.out.println("NamingException");
         ne.printStackTrace();
    } catch (NoSuchMethodException e) {
         System.out.println("NoSuchMethodException");
         e.printStackTrace();
    } catch (Exception e) {
         System.out.println("Other Exception");
         e.printStackTrace();
    ==========================
    ===========EXCEPTION (ONLY IF I REDEPLOY - IT WORKS PERFECT IF I RUN IT FIRST TIME)=================
    ==========================
    06/09/25 17:15:51 NamingException
    06/09/25 17:15:51 javax.naming.NameNotFoundException: ejb/TestWorkerAProxyBean not found
    06/09/25 17:15:51 at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
    06/09/25 17:15:51 at javax.naming.InitialContext.lookup(InitialContext.java:351)
    06/09/25 17:15:51 at com.myapp.master.RequestProcessorBean.processRequest(RequestProcessorBean.java:140)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
    06/09/25 17:15:51 at RequestProcessorLocal_StatelessSessionBeanWrapper4.processRequest(RequestProcessorLocal_StatelessSessionBeanWrapper4.java:37)
    06/09/25 17:15:51 at com.myapp.master.gateway.FrameworkGatewayBean.processObjectRequest(FrameworkGatewayBean.java:172)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
    06/09/25 17:15:51 at FrameworkGatewayRemote_StatelessSessionBeanWrapper10.processObjectRequest(FrameworkGatewayRemote_StatelessSessionBeanWrapper10.java:94)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
    06/09/25 17:15:51 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    06/09/25 17:15:51 at java.lang.Thread.run(Thread.java:595)

  • Client EJB JNDI lookup broken in OC4J 9.0.2?

    I have a client program that connects to an EJB in the application server and invokes methods on it. If it look up the EJB using the actual JNDI binding, it works fine. If I look it up in java:comp/env (and use the ejb-ref in application-client.xml and ejb-ref-mapping in orion-application-client.xml) the client program catches the following exception:
    caught : javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/logging/Logger
    javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/logging/Logger
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at com.mycompany.common.logging.ejb.test.LoggerEJBTest.main(LoggerEJBTest.java:37)
    Now, assuming I don't have any typos (and I'd be thrilled if someone pointed it out if that were the case), then it looks like this is a bug in OC4J 9.0.2: the ejb-ref and ejb-ref-mapping elements do not work. For the record, I am using the same ejb-ref and ejb-ref-mapping elements for a servlet's web.xml and orion-web.xml, respectively, without problems.
    Here are relevant file excerpts:
    LoggerEJBTest.java:
    String hostName = "localhost";
    String hostPort = "23791";
    String userName = "abc";
    String password = "def";
    String providerURL = "ormi://" + hostName + ":" + hostPort + "/ghi";
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
    env.put(Context.PROVIDER_URL, providerURL);
    env.put(Context.SECURITY_PRINCIPAL, userName);
    env.put(Context.SECURITY_CREDENTIALS, password);
    System.out.println("create initial context");
    Context context = new InitialContext(env);
    System.out.println("get home object");
    //works when uncommented
    //Object homeObject = context.lookup("logging/Logger");
    //broken:
    Object homeObject = context.lookup("java:comp/env/ejb/logging/Logger");
    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>
    <description>abc</description>
    <display-name>abc</display-name>
    <enterprise-beans>
    <session>
    <description>Logger Bean</description>
    <display-name>Logger</display-name>
    <ejb-name>Logger</ejb-name>
    <home>com.mycompany.common.logging.ejb.LoggerHome</home>
    <remote>com.mycompany.common.logging.ejb.Logger</remote>
    <ejb-class>com.mycompany.common.logging.ejb.LoggerBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    orion-ejb-jar.xml:
    <?xml version="1.0"?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 2.0 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar>
         <enterprise-beans>
              <session-deployment name="Logger" location="logging/Logger">
         </enterprise-beans>
    </orion-ejb-jar>
    application-client.xml:
    <?xml version="1.0"?>
    <!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN" "http://java.sun.com/dtd/application-client_1_3.dtd">
    <application-client>
         <display-name>logging test</display-name>
    <ejb-ref>
    <ejb-ref-name>ejb/logging/Logger</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.mycompany.common.logging.ejb.LoggerHome</home>
    <remote>com.mycompany.common.logging.ejb.Logger</remote>
    <ejb-link>Logger</ejb-link>
    </ejb-ref>
    </application-client>
    orion-application-client.xml:
    <?xml version="1.0"?>
    <!DOCTYPE orion-application-client PUBLIC "-//Evermind//DTD J2EE Application-client runtime 1.2//EN" "http://xmlns.oracle.com/ias/dtds/orion-application-client.dtd">
    <orion-application-client>
    <ejb-ref-mapping location="logging/Logger" name="ejb/logging/Logger" />
    </orion-application-client>

    As far as I know, the only way to lookup an EJB (deployed to
    OC4J) from a regular java class using the "ApplicationClientInitialContextFactory"
    class and the logical JNDI name is to include your regular java
    class (i.e. the client) in your application's EAR file (the file
    you use to deploy your application to OC4J).OK, but that sounds like a pretty silly constraint. Shouldn't the ApplicationClientInitialContextFactory know how to do the mapping using the application-client.xml and orion-application-client.xml settings? What does the OC4J server provide that makes this magically work?
    From the information you have supplied, it appears that you may
    not want to include your client (java) class in your EAR file.That is correct. It is an integration test program, not meant to be deployed into the application server.
    So now the question is, "Do you want to make your client part
    of your J2EE application, and include it in the application
    EAR file?"
    If you do, then you have made several mistakes which prevent
    you from doing that, but I don't want to explain further, since
    you may not want to do that, anyway!Not applicable. But on that topic, aside from being able to auto-start a client application within the OC4J JVM, are there any other reasons why I might want to deploy a client in that manner? I mean, honestly, these things are called "clients" and "servers" for a reason.
    Now if you have been reading other postings to this forum,
    and if you have read the documentation for OC4J, you would
    know that it requires J2SDK 1.3.1 only (not 1.4.0).I am well aware of the other postings on that topic. I am, however, counting on Oracle to live up to their promise to certify 1.4 with with the next update to OC4J:
    Limits of 10g
    That aside, I already consider OC4J 9.0.2 to be a broken product at this point anyway, so hacking it to use Java 1.4 doesn't bother me that much. OC4J 9.0.2 works about as well with Java 1.4 as with Java 1.3, assuming one replaces the tools.jar. The other major incompatibility is that Oracle SOAP breaks if a web service EJB home&remote interface is compiled with Java 1.4:
    http://forums.oracle.com/forums/message.jsp?id=936894
    Alas, we're using Apache SOAP 2.3 rather than the ass-backwards stuff in OC4J, anyways, so there's no problem.

  • JWS - EJB JNDI Lookup problem

    Hi,
    I have a client Java application accessing a session EJB in a remote JBoss J2EE server. I'm using JWS 1.2 to deploy my application but when I do a JNDI lookup to get access the the remote's object home interface I get this error:
    "Need to specify class name in environment or system property, or as an applet parameter, or in an application resorce file: java.naming.factory.initial"
    All the jar files are signed and the JNPL file contains <all-permissions/>. This is the code that triggers the exception
    jndiContext = new InitialContext();
    homeRMIReference = jndiContext.lookup(C_SERVICE_NAME);
    Any help would be appreciated.
    Thanks in advance,
    Rafael

    Hi,
    I've finally found the origin of the problem.
    1. JNDI uses a minimum set of properties during initialization phase:
    java.naming.factory.initial
    java.naming.factory.url.pkgs
    java.naming.provider.url
    Therefore these properties must be set in the <resource> topic of the JNLP file. The value of these properties is defined in the jndi.properties file that you can find in jbossjmx.ant.jar (within the jboss/client directory)
    2. You have to add the JBoss files to your bundle. For doing so I've unjared all the .jar files within the jboss/client directory; afterwards I have jared them in a single file "jboss.jar" and I've signed the file. I've added jboss.jar to the <resource> tag within the JNLP file (Note that I've added all the jboss files just to do quick check but usually you will have to add only those files you need (it doesn't make sense to deploy all JBoss files in each client application)
    I hope this helps,
    Rafael

  • Objects returned via JNDI Lookup

    All,
    I have had this nagging question in my head about JNDI lookups for some time
    now, but haven't had the time to do the proper research. The question is
    simple.
    The setup is simple as well. Suppose that we have a typical WLS setup, with
    WLS running in a JVM on a server host somewhere, with objects bound to its
    JNDI tree (we'll leave clustering out of the picture for simplicity's sake),
    and we also have a WLS client Java application. The client connects to WLS
    and performs various JNDI lookups on the server. Some of these objects
    implement java.io.Serializable, some do not.
    The question is, if the client uses JNDI to lookup an object that exsts in a
    separate JVM, and that object does not implement Serializable, how does this
    object come to be instantiated on the client?
    This leads to a second question: What exactly is getting returned from a
    JNDI lookup? A reference to an object or a copy of it? I can see that
    lookups within a single JVM would return a reference, but the cross-JVM
    lookup is less clear to me.
    Any and all help appreciated,
    -jc

    This leads to a second question: What exactly is getting returned from a
    JNDI lookup?From how I understand it, only Serializable objects are returned such as RMI
    stubs, which serve as proxies to EJB or other RMI servers registered in JNDI.
    - Thomas
    (ex-BONY too)
    Jonathan Castellani wrote:
    All,
    I have had this nagging question in my head about JNDI lookups for some time
    now, but haven't had the time to do the proper research. The question is
    simple.
    The setup is simple as well. Suppose that we have a typical WLS setup, with
    WLS running in a JVM on a server host somewhere, with objects bound to its
    JNDI tree (we'll leave clustering out of the picture for simplicity's sake),
    and we also have a WLS client Java application. The client connects to WLS
    and performs various JNDI lookups on the server. Some of these objects
    implement java.io.Serializable, some do not.
    The question is, if the client uses JNDI to lookup an object that exsts in a
    separate JVM, and that object does not implement Serializable, how does this
    object come to be instantiated on the client?
    This leads to a second question: What exactly is getting returned from a
    JNDI lookup? A reference to an object or a copy of it? I can see that
    lookups within a single JVM would return a reference, but the cross-JVM
    lookup is less clear to me.
    Any and all help appreciated,
    -jc

  • ClassCastException while looking up Home

    I have created a CMP Customer Bean, whose persistence fields are ID(PK), name, password and address inside the package navin.ejb.ecommerce.
    The bean has been deployed successfully.
    Now I have made an Login servlet also in the same package which allows login to customers whose name and password match with those in the database.
    But in the init() method when I lookup the bean, it gives the ClassCastException. The lookup should return a class of type navin.ejb.ecommerce.CustomerHome but it gives error as:
    java.lang.ClassCastException: navin.ejb.ecommerce.CustomerBeanHomeImpl_ServiceStub
    Can anyone tell me the possible solution. I am using Weblogic.

    Hello Navin,
    Try this out
    Object obj = ctx.lookup(<bean_jndi_name>);
    CustomerHome home = (CustomerHome) PortableRemoteObject.narrow(obj, CustomerHome.class)
    Also checkout the JNDI tree of the server, so that you are sure that teh name you are looking for in the lookup method is bound to the bean you want.
    Hope this helps.
    regards,
    Abhishek.

  • Problem in getting Home object of EJB in WebLogic 6.1

    Hello,
    I have deployed my stateless session bean with remote interfaces on my weblogic server but when i tried to access it from my client which is also present in the same application (ear) then it gives the following exception.
    java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:42)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:30)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:277)
    at java.lang.Class.newInstance0(Class.java:301)
    at java.lang.Class.newInstance(Class.java:254)
    at javax.rmi.CORBA.Util.createDelegateIfSpecified(Util.java:342)
    at javax.rmi.CORBA.Util.<clinit>(Util.java:54)
    at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(PortableRemoteObject.java:182)
    at javax.rmi.PortableRemoteObject.<clinit>(PortableRemoteObject.java:61)
    at jsp_servlet.__login._jspService(__login.java:123)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Caused by: java.lang.RuntimeException: could not find or instantiate any UtilDelegate class
    at weblogic.iiop.UtilDelegateImpl.<clinit>(UtilDelegateImpl.java:73)
    ... 18 more
    My code is like :
    UserRegistrationHome loginuser;
    Context initial = new InitialContext();
    Object objref = initial.lookup("ejb/SimpleUserRegistration");
    loginuser =(UserRegistrationHome) PortableRemoteObject.narrow(objref,UserRegistrationHome.class);
    UserRegistration userlogin = loginuser.create();
    It comes at line with PortableRemoteObject.......
    Will some one help me in this regard, as why this exception generally comes and in what settings....
    Thanks in advance.
    SAC

    Can you tell me how resolve the problem?
    Thanks,
    Michael
    [email protected]

  • EJB JNDI Lookup String?

    Hi,
    just a short question, I try to lookup an EJB from JNDI. I found some JNDI in the documentation of how to use EJB from JSP.
    Unfortunately the documentation just says:
    try {
      InitialContext ic = new InitialContext();
      HelloWorldBean h= (HelloWorldBean)ic.lookup("java:comp/env/<HelloWorldBean_Lookup_String>");
      out.println(h.sayHello());
    catch...
    I'm pretty sure "<HelloWorldBean_Lookup_String>" is not the correct lookup string
    Which one is it?
    Frank

    What I did now is to add the following into my web.xml:
    <ejb-local-ref>
      <ejb-ref-name>ejb/MyBean</ejb-ref-name>
      <local>package.MyBean</local>
    </ejb-local-ref>
    and the lookup through:
    InitialContext ic = new InitialContext();
    Mybean bean = (MyBean)ic.lookup("java:comp/env/ejb/MyBean");
    Thanx for all your help
    Frank

  • EJB - JNDI Lookup

    Hi Experts,
    I have create I Enterprise Season Bean. It's deployed on server correctly. But the lookup returns null. I have always problems with the correct lookup string. Is there a rule for the string? I never know If i have to write:
    a) localejbs/<srcFolder>~<ApplicationName>/EntityBeanName
    b) or without local at the beginning?
                      <srcFolder>~<ApplicationName>/EntityBeanName
    c) ...
    Can I see in the Visual Admin the corret path?
    Thanks in advance...

    Hi,
    Hope the below links give you the requried information.
    http://help.sap.com/saphelp_nwce10/helpdata/en/99/e8b84172133131e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/66/37014425a3ec439ffda58832e322e5/content.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/81/449e33158e654c9d0f17887d1ccb3a/content.htm
    Regards,
    Charan

  • EJB Home Objects and Stubs

    Hi,
    Can anyone pls tell me,what are the objects are created in Server after the Deployment of EJB.
    Is the EJB Home Object,EJB Home Object Stub,EJB Home Object Skeleton, EJB Local Home Object, EJB LocalHome Object Stub,Ejb LocalHome Object Skeleton.And Finally both the Stub objects and Skeleton Objects will be stored in the Jndi Registry ?
    Thanks in Advance,
    Venkat

    Nic,
    Caching the home object is a comon practice.
    Take a look here:
    http://www.theserverside.com/resources/patterns_review.jsp
    Look at the EJB Home Factory Pattern.
    Regards,
    -Dat

Maybe you are looking for

  • N73 Mobile shut down and not starting

    hi pls help me I having N73 nokia i having problem for my mobile last week suudenly switched off i try to make on its showing start up failier contact retailer can any one help me whats the problem for my divice

  • IPhone 4 fire

    Well I just woke up this morning and my daughters iPhone 4 melted to the charger and started to burn the couch. It was plugged into her MacBook last night. The computer is fine but the cord and phone is ruined. We yanked the phone from the USB cord d

  • How to restrict RFBILA00 to company codes

    Hello, I am still a SAP-rookie, so maybe you can help me. My problem is that in my company we have different users with different company codes using RFBILA00. How can I limit the RFBILA00 only for the company code of the current user? - (SAP Release

  • Broadband Connection Problem - Error 101

    I am getting connection problems every single day, everyting will be fine but then all webpages get this come up... It will happen on both my laptops and a desktop. IE will fail to connect as well as Chrome. I have to restart either the PC and /or BT

  • How to add CD/ Tapr Drv when the system is enable

    Sir is there any body who will help me to solve the problem that when the system is enable and I want to attach the CDROM & Tape Drive to the system what i have to do