EJB 3 JNDI lookup with WL 12c (12.1.1) Exception

Hi all,
I'm trying to lookup an EJB inside my application with the following code :
Context ctx = new InitialContext();
ctx.lookup("java:module/MyEJB");
it throws this Exception :
javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
     java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
     at javax.faces.component.UICommand.broadcast(UICommand.java:315)
     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
     Truncated. see log file for complete stacktrace
Caused By: javax.faces.el.EvaluationException: javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
     java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
     at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
     at javax.faces.component.UICommand.broadcast(UICommand.java:315)
     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
     Truncated. see log file for complete stacktrace
Caused By: javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
     java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
     at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:86)
     at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:466)
     at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:256)
     at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
     at weblogic.jndi.internal.ApplicationNamingNode.resolveObject(ApplicationNamingNode.java:170)
     Truncated. see log file for complete stacktrace
Caused By: java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
     java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject
     at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:384)
     at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:251)
     at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
     at weblogic.jndi.internal.ApplicationNamingNode.resolveObject(ApplicationNamingNode.java:170)
     at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
     Truncated. see log file for complete stacktrace
Caused By: java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
     Truncated. see log file for complete stacktrace
i'm using WL 12c, JDK 1.6.29.
regards.

I can't upload all the project, but i will upload the [required files|http://dl.dropbox.com/u/79750638/WLForum.7z] .
inform me if you need more info.
thanks

Similar Messages

  • Anyone knows how to do JNDI lookup with OracleAQ?

    Hi all;
    Can anybody point me some guide/idea on how to implement JNDI lookup with OracleAQ?
    (Creating connectionFacotry , parameters for "java.naming.factory.initial", java.naming.provider.url etc..)
    Thanks
    -Ratha
    Edited by: Ratha on Sep 27, 2011 3:50 AM

    import javax.naming.*;
    import javax.naming.directory.*;
    import java.util.Properties;
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, PROVIDER_URL);
    env.put(Context.SECURITY_PRINCIPAL, JNDI_USER);
    env.put(Context.SECURITY_CREDENTIALS, JNDI_PWD);
    InitialContext = new InitialDirContext(env);
    where JNDI_USER is the userid If ACL is configured at the JNDI server
    where JNDI_PWD is the password If ACL is configured at the JNDI server
    Context.INITIAL_CONTEXT_FACTORY is the initial Context factory and depends on ur JNDI service provider.
    PROVIDER_URL is the url of the JNDI server containing protocol/ip/port
    Hope it helps
    -aseem

  • Calling BRM from UDF using JNDI lookup with @EJB annotation

    Hi Experts
    I am trying to implement a UDF to invoke my BRM Rules set via JNDI Lookup instead of a SOAP Channel lookup.
    I have had a look at the following links/docs:
    Calling BRM from UDF using Public API
    http://www.gleanster.com/system/resources/W1siZiIsIjIwMTIvMDgvMDcvMjAvNDcvNTAvNDMvVGhpbmdzX1lvdV9TaG91bGRfS25vd19hYm91dF9TQVBfTmV0V2VhdmVyX0JSTS5wZGYiXV0/Things%20You%20Should%20Know%20about%20SAP%20NetWeaver%20BRM.pdf
    For item 1 above, the example looks really good, but it doesnt explain how I get access to the following required imports from my UDF:
    import com.sap.brms.qrules.ejb.*;
    import com.sap.brms.qrules.engine.AbstractProject;
    import com.sap.brms.qrules.engine.RuleEngine;
    import com.sap.brms.qrules.engine.RulesetContext;
    import javax.ejb.EJB;
    The second document is really good as well, but I could not figure out how to get it to work from my UDF.
    So, can anyone help me to understand specifically what is required to get this to work?
    Is is possible to invoke the rule set from my UDF?
    How do I give my UDF access to all the required jars/imports?
    I have manage to create a new DC (Development Component) with a public part and this enables me to get my code to compile on my local PC but I am not able to activate it due to the server not having access to the same java packages as my local copy.
    Any help would be greatly appreciated.

    You resolve the dependency by importing the required jars with using the dependency tab for the mapping program.
    As stipulated before, I have managed to resolve the dependency issue but I have now getting the same error as in the forum: Calling BRM from UDF using Public API
    The specific error is:
    com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:238)
    Has anyome manage to get invoke a BRM Ruleset using JNDI?

  • Calling non ejb from ejb using jndi lookup

    Is it possible to call a non ejb java object from an ejb using a jndi lookup?
    For example, we have a java class where main registers itself with our application server (JBoss 3.0.1). We have a test client that can use jndi to look up the object, but we can't get an ejb inside the application server to use the object.
    Are we trying to do the impossible? If my question is not clear, please let me know so I can try to clarify.
    Thanks

    JNDI uses factories to create objects.
    It's possible that JBoss has a Bean Factory which you can use to create your instance.
    Tomcat has a Bean factory in its JNDI implementation. I use it just as you have indicated.
    The JBoss documenation may help?
    Dave

  • EJB 3.0 lookup with WLS 10.3.0

    Hello everyone,
    1: Our application runs on Weblogic Application Server,version 10.3.0
    2: In our system,we need to deploy an EJB conforming to the EJB 3.0 specification.
    Please find the sample code for our UAT environment as below :
    /*The remote interface*/
    package com.serverside.ejb.session;
    import javax.ejb.Remote;
    @Remote
    public interface ASimpleSessionBeanRemote {
         public void printThis(String print);
    /*The bean class*/
    package com.serverside.ejb.session;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    * Session Bean implementation class ASimpleSessionBean
    @Stateless(name="ASimpleSessionBean", mappedName = "ASimpleSessionEJB")
    @Remote(ASimpleSessionBeanRemote.class)
    public class ASimpleSessionBean implements ASimpleSessionBeanRemote {
    * Default constructor.
    public ASimpleSessionBean() {
    // TODO Auto-generated constructor stub
         @Override
         public void printThis(String print) {
              // TODO Auto-generated method stub
              System.out.println("ASimpleSessionBean : "+print);
    3: The above files when packaged in jar get deployed on the server successfully.
    4: As per EJB 3.0 specification,the deployement descriptors are not mandatory.Hence,the jar doesn't include ejb-jar.xml and weblogic-ejb-jar.xml
    5: Please find below,the EJB3.0 annotations reference as per the Weblogic Application Server Documentation :
    Annotation : @Stateless
    Package: javax.ejb.Stateless
    Attribute : mappedName
    Description :
    Specifies the product-specific name to which the stateless session bean should be mapped.
    You can also use this attribute to specify the JNDI name of this stateless session bean. WebLogic Server uses the value of the mappedName attribute when creating the bean’s global JNDI name. In particular, the JNDI name will be:
    mappedName#name_of_businessInterface
    where name_of_businessInterface is the fully qualified name of the business interface of this session bean.
    For example, if you specify mappedName="bank" and the fully qualified name of the business interface is com.CheckingAccount, then the JNDI of the business interface is bank#com.CheckingAccount.
    6: Conforming to the above specification, the sample EJB deployed on our application server has the binding name(as reflected in the jndi tree) as follows :
    ASimpleSessionEJB#com.serverside.ejb.session.ASimpleSessionBeanRemote
    A jndi lookup using this name succeeds :
    InitialContext.doLookup("ASimpleSessionEJB#com.serverside.ejb.session.ASimpleSesionBeanRemote");
    7: Now,we want the binding name to be a simple string i.e the lookup must be something like :
    InitialContext.doLookup("ASimpleSessionEJB");
    8: To implement point-7,we tried using the ejb-jar.xml and weblogic-ejb-jar.xml as follows :
    ->ejb-jar.xml
    <?xml version="1.0" encoding="ASCII"?>
    <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
    <display-name>ejb</display-name>
    <enterprise-beans>
         <session>
              <ejb-name>ASimpleSessionBean</ejb-name>
              <ejb-ref>
                   <ejb-ref-name>ASimpleSessionEJB</ejb-ref-name>
                   <remote>com.serverside.ejb.session.ASimpleSessionBeanRemote</remote>
                   <mapped-name>ASimpleSessionEJB</mapped-name>
              </ejb-ref>
         </session>
    </enterprise-beans>
    </ejb-jar>
    ->weblogic-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-ejb-jar xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
    <!-- server-version: 10.3.0 --><wls:weblogic-enterprise-bean>
         <wls:ejb-name>ASimpleSessionBean</wls:ejb-name>
         <wls:stateless-session-descriptor>
              <wls:business-interface-jndi-name-map>
                   <wls:business-remote>ASimpleSessionBeanRemote</wls:business-remote>
                   <wls:jndi-name>ASimpleSessionEJB</wls:jndi-name>
              </wls:business-interface-jndi-name-map></wls:stateless-session-descriptor>
         <wls:jndi-name>ASimpleSessionEJB</wls:jndi-name>
    </wls:weblogic-enterprise-bean>
    </wls:weblogic-ejb-jar>
    9: Inspite of the point-8,the binding name remains as follows :
    ASimpleSessionEJB#com.serverside.ejb.session.ASimpleSessionBeanRemote
    10: Please guide us about the solution and implementation to attend point-7.
    Thanks

    user13531611 wrote:
    10: Please guide us about the solution and implementation to attend point-7.
    ThanksOkay. I guide you... to the correct forum branch, because this is a Weblogic specific problem. Server specific issues hardly ever get resolved in the Enteprise Javabeans thread.
    http://forums.oracle.com/forums/category.jspa?categoryID=193
    Make a new post there and if you are really decent you post a link to it here so in the off-chance that someone capable to help finds this post and thus can follow it to your real thread.

  • JNDI lookup with DNS

    Hi all,
    we are using 2 weblogic 5.1 servers (not clustered) for
    our load balancing solution. In our client applications,
    we use a hostname against a DNS for the JNDI lookups for our
    RMI objects deployed on the 2 weblogic servers.
    Ideally, a round-robin load balancing is expected.
    But in reality, all the lookups are sticking to one of our
    servers until we restart our client applications. The
    lookups may switch to another. In our applications,
    we are making many subsequent RMI lookup using JNDI.
    We would like to spread the remote method invocation
    between our 2 servers. How can we integrate with the
    DNS? We have proved that the DNS will return the
    IP addresses of the 2 weblogic in round-robin manner.
    thanks!
    cheers,
    Kenneth
    [email protected]

    Ken,
    What client are you using? We had the same problem when we switched from
    Windows NT to Windows 2000 clients. Round-robin worked fine in NT and by
    default got "stuck" when we tried it from Win 2000 client. There is a
    setting in the network properties on Win 2000 to "unstick" that will fix the
    problem, if this is the setup you have?
    Bart Jenkins, Globeflow SA
    [email protected]
    "Kenneth Yue" <[email protected]> wrote in message
    news:3bb09863$[email protected]..
    >
    >
    Hi all,
    we are using 2 weblogic 5.1 servers (not clustered) for
    our load balancing solution. In our client applications,
    we use a hostname against a DNS for the JNDI lookups for our
    RMI objects deployed on the 2 weblogic servers.
    Ideally, a round-robin load balancing is expected.
    But in reality, all the lookups are sticking to one of our
    servers until we restart our client applications. The
    lookups may switch to another. In our applications,
    we are making many subsequent RMI lookup using JNDI.
    We would like to spread the remote method invocation
    between our 2 servers. How can we integrate with the
    DNS? We have proved that the DNS will return the
    IP addresses of the 2 weblogic in round-robin manner.
    thanks!
    cheers,
    Kenneth
    [email protected]

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

  • WL 4.5.1 JNDI defaults,JNDI lookup with multiple environments etc..

    The WL4.5 docs, state that if "java.naming.provider.url" is not
    explicitly provided
    (either during the JVM start or in the InitialContext), the WL will
    default to
    "t3://localhost:7001".
    Q1) If server is listening on a different port, shouldn't we explicitly
    specify the
    "-Djava.naming.provider.url=t3://theServerIP:theServerPort" during the
    WL JVM
    start-up. If we don't, how would the naming lookup work, when there is
    no naming
    service on the "localhost:7001"
    In the real life, usually there are several (usually identical) copies
    of the WL server
    instances running in (DEV/TEST/QUAL environments. Assume that all
    servers are
    on the same network and have the same EJBs deployed (using the same home
    names).
    Q2) Does each WL instance have its own naming service running? (assume
    yes)
    Q3) If no WL instances listen on 7001, what happens with Q1?
    Q4) If client specifically sets the TEST server IP:port for the
    "java.naming.provider.url", would TEST naming service first lookup its
    own tree and
    then, if object does not exist ask other naming services (assume yes ...
    how is this
    set-up, how do the WL naming services discover each other)
    Q5) How many naming services would run if all WL instances are running
    on the
    same machine using different listen ports? (assume N)
    Darko Bohinc
    Consultant - Synergy International Limited
    Level 7, Synergy House, 131 Queen Street, PO Box 7445 Wellesley Street,
    Auckland, NZ
    Phone: +64 9 3772400
    Fax: +64 9 3772444
    URL: http://www.synergy.co.nz

    No,version 4.5 is built to the 1.1 API.
    Version 1.5 is updated to JNDI 1.2.
    Thanks,
    Michael
    Michael Girdley
    BEA Systems Inc
    <[email protected]> wrote in message news:[email protected]..
    Hi All
    I have been using WL 4.5.1 for a while with JNDI 1.1.2 which are
    included in weblogicaux.jar.
    Can I use JNDI 1.2.1 with WL 4.5.1 by overriding the default 1.1.2 ?
    If so, how do I do it?
    Thanks
    Madhu

  • EJB 3 jndi lookup from glassfish to glassfish

    Hi,
    I have a big problem with remote access to EJB3 deployed on a glassfish server . I can get it work from a SE client or a Tomcat server but when I deploy the same code on another glassfish server,
    I get a javax.naming.NameNotFoundException.
    Here is my lookup code :
         prop.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
                             prop.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
                             prop.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
                             prop.setProperty("java.naming.provider.url","iiop://192.168.2.13:3700");
                             prop.setProperty("org.omg.CORBA.ORBInitialPort","3700");
                             prop.setProperty("org.omg.CORBA.ORBInitialHost","192.168.2.13");
                             System.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.2.13");
                             System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                             InitialContext ic = new InitialContext(prop);
                             out.println("found :"+ic.lookup("big.com.model.MyEJBRemote"));any help welcome.
    thank.

    Have you tried this: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    Specifically using the no-arg constructor?

  • Weblogic JNDI lookup with JDK1.2

    Hi,
    I've written JMS client that sends message to weblogic 8.1,
    and I use "weblogic.jndi.WLInitialContextFactory" to get access to resources.
    Now the problem is that my client can run only on JDK 1.2 and
    so when I send message I get exceptions about some security classes which
    webligic's JNDI is implementing looks like:
    java.lang.NoClassDefFoundError: javax/security/auth/callback/CallbackHandler
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:131)
    I was wondering if there is any way to a client running on JDK 1.2
    to get access to weblogic's JNDI, other than using WLInitialContextFactory,
    or I have to go to Weblogic 6?
    Any help is appreciated!
    Thanks,
    Ann

    Hi,
    I've written JMS client that sends message to weblogic 8.1,
    and I use "weblogic.jndi.WLInitialContextFactory" to get access to resources.
    Now the problem is that my client can run only on JDK 1.2 and
    so when I send message I get exceptions about some security classes which
    webligic's JNDI is implementing looks like:
    java.lang.NoClassDefFoundError: javax/security/auth/callback/CallbackHandler
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:131)
    I was wondering if there is any way to a client running on JDK 1.2
    to get access to weblogic's JNDI, other than using WLInitialContextFactory,
    or I have to go to Weblogic 6?
    Any help is appreciated!
    Thanks,
    Ann

  • EJB calling Spring Bean with non XA Datasources causing Rollback Exception

    We have an EJB CMT with Required calling a spring bean (@Transactional Propagation.NOT_SUPPORTED). This is causing an Rollback Exception saying 2 phase commit must be enabled. The EJB has to write to datasource 1, but the Spring Bean is ready only on Data Source 2. The Data Sources are set to use Non XA Driver with Support Global Transaction enabled for One phase commit. Any help is appreciated.

    We have an EJB CMT with Required calling a spring bean (@Transactional Propagation.NOT_SUPPORTED). This is causing an Rollback Exception saying 2 phase commit must be enabled. The EJB has to write to datasource 1, but the Spring Bean is ready only on Data Source 2. The Data Sources are set to use Non XA Driver with Support Global Transaction enabled for One phase commit. Any help is appreciated.

  • EJB 3.0 and jndi lookup (simple question)

    hi all,
    i am newbie on Weblogic Application Server and i have some issues,
    i have weblogic application server 10.0, also i have oracle timesten in-memory database, i have configured datasource and deploy my ejb 3.0 application, but i could not done jndi lookup?
    here is my example:
    1. one stateless session bean :
    import javax.ejb.Remote;
    @Remote
    public interface InsertSubscriber {
         public void insertSubscriber(SubscriberT subscriberT);
    } 2. here is it's implementation :
    @Remote(InsertSubscriber.class)
    @Stateless
    public class InsertSubscriberBean implements InsertSubscriber {
         @PersistenceContext(unitName = "TimesTenDS")
         private EntityManager oracleManager;
         public void insertSubscriber(SubscriberT subscriber)
              try {
                   System.out.println("started");
                   oracleManager.persist(subscriber);
                   System.out.println("end");
              } catch (Exception e) {
                   e.printStackTrace();
    }3 and my test client :
    public class Client {
         public static void main(String[] args) {
              Context ctx = null;
              Hashtable ht = new Hashtable();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
              try {
                   ctx = new InitialContext(ht);
                   InsertSubscriber usagefasade = (InsertSubscriber) ctx
                             .lookup("ejb.InsertSubscriberBean");               
              } catch (NamingException e) {
                   e.printStackTrace();
              } finally {
                   try {
                        ctx.close();
                   } catch (Exception e) {
                        e.printStackTrace();
    }what i did incorrect ???
    i got error like this : Name not fount exception
    when i tried to view jndi tree on weblogic server application console i found this :
         Binding Name:     
    TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber     
         Class:     
    test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub     
         Hash Code:     
    286     
         toString Results:     
    weblogic.rmi.internal.CollocatedRemoteRef - hostID: '2929168367193491522S::billing_domain:AdminServer', oid: '286', channel: 'null'what does it mean how i can done lookup to jndi ?
    Regards,
    Paata Lominadze,
    Magticom LTD.
    Georgia.

    Hi All,
    I am using the weblogic cluster with session replication and EJB 2.0 with Local entity beans.
    for fail-over session should be replicated to another server so we can achive the same session if 1st server fails.
    Suppose i m using two managed server(server1,server2) in the cluster.I am storing the object of class ABC into session and object contains the instance of Local-EntityBean home but i put that as a transient.I have also override the readObject and write object method.
    when write object is called on 1st server,readObject method should be called on second server so we will be sure that session is replicating properly.
    pleaase find the code below : -
    public IssuerPageBean() {
    initEJB();
    private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    initEJB();
    initializeCommonObject();
    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    private void initEJB() {
    try {
    ic = new InitialContext();
    issuerHome = (LocalIssuerHome) ic.lookup("java:comp/env/Issuer");
    } catch (NamingException e) {
    e.printStackTrace();
    in my case if i am calling the constructor IssuerPageBean(),it calls the initEJB() method and lookeup the entity local home properly but when readObject method is called on another server only initEJB() method is called directly and getting the exception below :
    WARNING: Error during create -
    javax.naming.NameNotFoundException: remaining name: env/ejb/Client
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;Z)Ljavax/naming/Context;(SimpleContext.java:35)
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;)Ljavax/naming/Context;(SimpleContext.java:39)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(SimpleContext.java:62)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(Ljava/lang/String;)Ljava/lang/Object;(ReadOnlyCont
    extWrapper.java:45)
    at weblogic.jndi.internal.AbstractURLContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(AbstractURLContext.jav
    a:130)
    at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:347)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.initEJB()V(ClientPageBean.java:218)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.readObject(Ljava/io/ObjectInputStream;)V(ClientPageB
    ean.java:191)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at java.util.HashMap.readObject(Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at weblogic.common.internal.ChunkedObjectInputStream.readObject()Ljava/lang/Object;(ChunkedObjectInputStream.jav
    a:120)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(Ljava/lang/Class;)Ljava/lang/Object;(MsgAbbrevInputStream.java:
    121)
    at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi
    /spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic
    /rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
    Please help .
    Thanks in Advance.
    Edited by hforever at 03/04/2008 7:28 AM

  • EJB 3.0 JNDI lookup results in Classcast Exception

    Hello everybody,
    I�m experiencing a strange problem when I want to retrieve a stateless session bean from a POJO in my enterprise app. I am using EJB 3.0, running on Glassfish build 33 and JDK 1.5.
    I have successfully deployed my ear file which has the EJB.jar and the war file in it. I�m using JSF 1.2 in the web app and I am able to use all session beans using the injection annotation in my managed beans (this is how it is supposed to be according to the spec.). However, I now need to acces a stateless session bean from a POJO (non-managed or backing bean) which resides also in the war file. I�m using the following code to retrieve the session bean:
    (where IMySessionBean = remote interface and MySessionBean is the implementation)
    try {
    ic = new InitialContext();
    MySessionBean mybean = (MySessionBean )ic.lookup("env/IMySessionBean");
    When casting the object from the lookup into MySessionBean I get a classcast Exception. However, I can see the session bean using the JNDI browser that comes with Glassfish and it�s deployed and available. If mybean is of type Object, I see that the lookup method returns a wrapper of my session bean.
    Here�s what the stacktrace says:
    java.lang.ClassCastException: com.myproject.ejb.interfaces._IMySessionBean_Wrapper
         at ...
    Do I miss something here and there�s more required to obtain a reference to the session bean? I�m pretty much stuck here and any help is greastly appreciated!
    Thanks in advance!
    Cheers,
    Joerg

    Hi Joerg,
    In the session bean client view, the bean implementation class is never used. The client
    only interacts with the local or remote interface.
    Regarding the lookup, the more portable approach is to
    lookup the ejb reference through the component environment of the web application
    rather than doing a direct global lookup. If you have already defined any ejb reference
    injections somewhere in the web app, you can look up the same dependencies via
    java:comp/env. For example, if your managed bean has the following @EJB annotation :
    @EJB(name="mybeanref") IMySessionBean beanRef;
    You can look up the same underlying dependency in your utility class :
    IMySessionBean beanRef = (IMySessionBean) new InitialContext().lookup
    ("java:comp/env/mybeanref");
    Note that the portion of the lookup string after java:comp/env/ comes from the name() attribute
    of @EJB. @EJB name() has the same semantics as the ejb-ref-name in the deployment
    descriptor. You can find more info on these topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • JNDI Lookup in JSP fails for EJB 3.0

    I am new to Java technology. I read the EJB FAQ, NetBeans docs and may forum discussions and I am still confused with the error I am having.
    Background:
    I have developed a persistance bean and related sessions beans (similar to the customer-cmp-ear application in the Java App Server samples). Now I am trying to access this bean using a JSP. After deploying the war file in the App Server and try to access the page, I get the following error.
    javax.naming.NameNotFoundException: No object bound to name java:comp/env/ConsumerSessionLocal
    After reading many articles, I understood that I dont have to prepare any descriptors, or JAR files for EJB 3.0.
    Environment Details:
    Java App Server Ver 9.0
    NetBeans 5.5
    I normally build the war files using NetBeans.
    I use App Server Admin console to deploy the web applications using the above war file.
    EJB details:
    Persistance EJB : person.java
    Session Objects
    Consumer.java (this implements ConsumerSessionLocal, ConsumerSessionRemote). This Stateless bean accesses the methods in person.java.
    ConsumerSessionLocal.java - local interface
    ConsumerSessionRemote.java - remote interface
    SearchConsumer.jsp
    This JSP page is calling the ConsumerSessionLocal using the JNDI lookup through InitialContext.
    Here is the Code snippet:
    try {
    InitialContext ic = new InitialContext();
    Object o = ic.lookup("java:comp/env/ConsumerSessionLocal");
    ConsumerSessionLocal consSession = (ConsumerSessionLocal) o;
    I am able to see the jsp page in the browser, however, after a submit action, I get the Java Naming Exception error.
    javax.naming.NameNotFoundException: No object bound for java:comp/env/ConsumerSessionLocal
    I would appreciate your help/any of your thoughts.
    Thanks in advance.
    -Ram

    I did not really solve it. Instead I used some of the tutorials that used JNDI lookup and modified those as my way forward. I did not really find out exactly what I was doing wrong.
    /Anders

  • JNDI lookup from Tomcat to EJB Container

    Hello!
    i am currently trying to use a combination of Catalina and an external EJB Server (running on another machine).
    i am really struggeling with doing the jndi lookup. i have no idea where and how to set the properties in the web server and do the mapping from the ejb-refs to the jndi name? (since tomcat doesnt seem to have a deploymentplan?!)
    maybe someone here knows the problem and can help, please?
    (i am not sure but this might also be the wrong discussion group for that??)
    thanks
    wolfgang

    Hello Wolfgang,
    I solved this problem by setting the proper jndi properties in the startup phase (MyInitServlet) by System.setProperty(...).
    This seems ugly, but it works.
    Tilo

Maybe you are looking for

  • My 4G ipod can't play the musics and now it can't be turn on

    Hello. I'm a 4G itouch user. first when I write the lyrics on my songs, it can't be played. just 3 songs that can be played, when it supposed to play the next song,it skip itself,and after the 3 songs played, it go back to the songs list,50 songs was

  • Dir listing with umlauts / special characters

    I've got a directory tree, where several files have umlauts or french accented characters in their names. When I do 'ls' in such a directory, I can see the umlauts fine in Terminal, e.g.: Die rote Wüste - Michelangelo Antonioni.avi Nazarin - Luis Buñ

  • Problems with the password with WebClient but not with Siebel Tools

    Hello, I am having problems when I am trying to connect with the WebClient against local database. When I put the user and the password i obtain a message that said me that the password and user is incorrect. When I use the same password and user in

  • HT4855 Right mouse button suddenly changed

    Using my right mouse button suddenly starts the application instead of activating the options menu. What happened?

  • Lenovo XP Mode versus Windows XP Mode?

    I'm in the process of setting up a new W520 that was ordered with the "Windows XP Mode" option. The relevant menu folder has entries for both a "Lenovo XP Mode" and the expected "Windows XP Mode." What's the difference, if any? I hesitate to do the o