EJB 3.0 Stateless SessionBean concurrency

Hi everyone, i have this problem with an applcation. I have a @Stateless session bean that is accessed by (60-100) clients at the same time. In some of the services of the stateless bean i need to make some operations that involve the use of transactions, my problem is that i dont know if i can use an entity manager injected like:
@PersistenceContext(unitName="pu1")
private EntityManager em;
Because if 5 clients access the bean at the same time they are going to share the same persistent context in the EntityManager em, and they wont have a transactional context.
To avoid this, i`m thinking in using an EntityManagerfactory and use it everytime a client mekes a request to guarantee the transactional context, the problem is that i have to do something like this every time for a transaction to work:
EntityManager em = emf.createEntityManager();
try {
em.getTransaction().begin();
try {
// work
em.getTransaction().commit();
} catch (Throwable t) {
em.getTransaction().rollback();
throw t;
} finally {
em.close();
I dont know if im missing the advantages of the session bean, dont know if i have to use a Statefull session bean, to aviod the concurrency inconvinient.

Concurrency is automatically handled by the ejb container so there's no need to write special code to handle it. The container will guarantee that at most one thread is executing within each stateless session bean instance at a time, so there won't be any concurrency issues regarding the access of the container-managed EntityManager.
The issue you raise can be a problem when injecting a non-sharable resource into a servlet instance, since the web container can use the same servlet instance to process multiple concurrent threads.
--ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • How to use Transaction in Stateless SessionBean?

    I want to use a transaction in a stateless sessionbean.Here is the code I am using:
    public void createQuestion(QuestionModel questionModel,Collection outcomeList) throws Exception{
    UserTransaction ut=getUserTransaction();
    try{
    QuestionHome qHome=EJBUtil.getQuestionHome();
    QuestionOutcomeHome qoHome=EJBUtil.getQuestionOutcomeHome();
    ut.begin();
    QuestionRemote qr=qHome.create(questionModel.getName(),questionModel.getContent(),questionModel.getCreatorId());
    Long id=qr.getQuestionModel().getId();
    Iterator outcomes=outcomeList.iterator();
    while(outcomes.hasNext()){
    QuestionOutcomeModel qom=(QuestionOutcomeModel)outcomes.next();
    QuestionOutcomeRemote qor=qoHome.create(id,qom.getValue(),qom.getFeedBack());
    ut.commit();
    }catch(Exception e){
    ut.rollback();
    throw new Exception(e);
    private UserTransaction getUserTransaction() throws NamingException{
    UserTransaction ut=null;
    try{
    InitialContext ic = new InitialContext();
    ut = (UserTransaction) ic.lookup("UserTransaction");
    } catch (NamingException ne) {
    throw new EJBException(ne);
    return ut;
    And In the entity bean,I define a XADatasource:
    private Connection getXADBConnection() throws SQLException {
    Connection connection;
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource)
    ic.lookup("java:/MSSQLXaDS");
    connection = ds.getConnection();
    } catch (NamingException ne) {
    throw new EJBException(ne);
    } catch (SQLException se) {
    throw new EJBException(se);
    return connection;
    When I run the code, it throws the following Exception:
    java.lang.Exception: java.lang.reflect.UndeclaredThrowableException
         at com.dynasty.testing.testcontent.control.TestContentSB.createQuestion(TestContentSB.java:239)
         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:324)
         at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
         at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
         at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
         at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
         at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
         at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
         at org.jboss.ejb.Container.invoke(Container.java:712)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
         at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
         at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
         at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:138)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
         at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
         at $Proxy1.createQuestion(Unknown Source)
         at com.dynasty.testing.test.TestContentSBTestClient1.main(TestContentSBTestClient1.java:466)
    Caused by: java.lang.reflect.UndeclaredThrowableException
         at $Proxy196.create(Unknown Source)
         at com.dynasty.testing.testcontent.control.TestContentSB.createQuestion(TestContentSB.java:229)
         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:324)
         at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
         at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
         at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
         at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
         at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
         at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
         at org.jboss.ejb.Container.invoke(Container.java:712)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
         at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
         at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
    Caused by: javax.resource.ResourceException: associateConnection not supported
         at org.jboss.resource.adapter.jdbc.BaseManagedConnection.associateConnection(BaseManagedConnection.java:91)
         at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:594)
         at org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:344)
         at org.jboss.resource.connectionmanager.CachedConnectionManager.pushMetaAwareObject(CachedConnectionManager.java:140)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:183)
         at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:90)
         at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
         at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
         at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:59)
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
         at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
         at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
         at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
         at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
         at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
         at org.jboss.ejb.Container.invoke(Container.java:730)
         at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
         at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
         at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
         ... 28 more
    What's wrong with my code?Can anyone hlep me?Thanks

    Susan,
    I am replying because I think we are in the same class at Wake Tech (Saturday morning with Jeff Griemann), trying to get past the same problem. After many frustrating hours, I have the answer. Reinstall Tomcat in a directory with NO SPACES in the directory name. That it!
    Dennis

  • RuntimeException through Stateless SessionBeans causes JNDI lookup crash

    Hello,
    It seems there is a big problem with the RuntimeException thrown through two Stateless SessionBeans. Here is the code (without the interfaces, that are straight forward) :
    public class ProcessorBean { public String process() { throw new RuntimeException("error"); } } /* This is a sub-bean that throws a simple RuntimeException */
    public class OtherBean  { public String hello() { return "processed by OtherBean"; } } /* Another sub-bean to test the catch-call (optional) */
    public class TestBean
        @EJB
        private ProcessorLocal processor;
        @EJB
        private OtherLocal other;
        public String process()
              String result = null;
              try
                  result = processor.process(); //will throws a RuntimeException
              catch(Exception e)
                  result = other.hello(); //CRASH !!!! --> afther that processor.process() trhows a RuntimeException, all injections @EJB are down ! There will be a ejb.some_unmapped_exception written in the console.
              return result;
    }You will find a little Enterprise project here to see the problem (just use the WebService tester in asadmin)
    Note that there is no problem if an Exception that DOES NOT inherit from RuntimeException is thrown.
    Maybe someone have an idea how to solve simply that problem ?
    Regards,
    Cedric

    What is your exception exactly?
    I deploeyd you jar package in JBoss 5.0, and called your facade bean with this code:
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import ch.capi.test.RemoteFacadeRemote;
    public class MainRemoteEJBCaller {
         public static void main(String[] args) throws Exception {
              Properties env = new Properties();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
              env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
              env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
              InitialContext jndiContext = new InitialContext(env);
              Object ref = jndiContext.lookup("RemoteFacadeBean/remote");
              RemoteFacadeRemote facadeBean = (RemoteFacadeRemote)PortableRemoteObject.narrow(ref,RemoteFacadeRemote.class);
              System.out.println( facadeBean.test("Test") );
              System.out.println( facadeBean.testException("Test") );
    }And got not errors. The output is this:
    Your input : [Test] / You're saved !
    You're saved !- Roy

  • Some methods not working in EJB 3.0 stateless session bean

    Hi,
    I am trying to build an application with EJB 3.0 stateless session bean in weblogic 10. In that during build (using ant 1.6) it showing error as one of the ejb-class should have anotataion as @stateless, @stateful or @messageDiven
    But i have given it corrrectly.
    When I comment some of the methods the same bean is working fine. While i have annoatated some of the methods with @transaction attribute annotataion.
    So, should i write all those methods there any particular order or what.
    Can anybody pls tell me, what can be the problem as weblogic.appc is giving such error?

    Hi,
    I am trying to build an application with EJB 3.0 stateless session bean in weblogic 10. In that during build (using ant 1.6) it showing error as one of the ejb-class should have anotataion as @stateless, @stateful or @messageDiven
    But i have given it corrrectly.
    When I comment some of the methods the same bean is working fine. While i have annoatated some of the methods with @transaction attribute annotataion.
    So, should i write all those methods there any particular order or what.
    Can anybody pls tell me, what can be the problem as weblogic.appc is giving such error?

  • Calling EJB 3.0 Stateless Session Bean

    Dear all,
    I created a stateless session bean with a hello world method on it. Now i want to call the method from a BeanDecorator class, through a getter metod. When i use the jndi lookup in my getter, i can call the helloWorld method without a problem. However, when i dont use the jndi lookup, and only use the @EJB annotation, i always get a nullpointer.
    This is working:
    InitialContext ic = new InitialContext();
                   test = (TestLocal)ic.lookup("test.be/ear~bd/LOCAL/TestBean/"+TestLocal.class.getName());
                   test.helloWorld()
    This gives nullpointer:
    @EJB
    private TestLocal test;
    test.helloWorld();
    What is the correct way to consume session beans without having to explicitly code the jndi lookup?
    Kind regards.

    Hi,
    any annotation like this can be used only in "managed classes" like Session Beans, Servlets etc. Managed classes are those classes managed by the J2EE server. Managed here means, lifetime controlled by server.
    You can find this in J2EE specification.
    Frank

  • Odd marshalling problems with EJB 3.0 stateless session bean

    Hello,
    I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
    full stack trace:
    com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)

    Hello,
    I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
    full stack trace:
    com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)

  • EJB 3.0 @Stateless @EJB @Resource and JNDI clarity..

    Hi,
    I am trying to configure an EJB 3.0 but not able to do so properly.
    I have a single business interface and 2 bean implementation class of the same business interface doing different things. How do I access the EJB's if I have the same business interface class.I am getting JNDI error while trying to lookup.
    Also what does the "name" and "mappedName" in @Stateless(name ="...",mappedName="") signify.
    Then in case of Dependency injection,how should I look for the EJB? What would be it's JNDI name in this case?
    @EJB(name="",beanName="",mappedName="")
    private HelloEJB hello;
    What does the name,benaName and mappedName in case of an @EJB annotation signify??
    Please clear me with these attributes of @Stateless and @EJB and @Resource. I am getting toatlly confused with what should be the logic name and what is the JNDI name????
    Thanks

    In @Stateless, @name() is the annotation equivalent of <ejb-name> in ejb-jar.xml. It gives a unique bean name identifier to the component within the ejb-jar. It is completely independent of mappedName. If no @Stateless name() is specified, it defaults to the unqualified bean class name.
    In @Stateless, mappedName() is used to assign a global JNDI name to the bean's remote interface. This can be used to explicitly lookup the EJB reference to that interface or as one way to resolve a caller's EJB dependency.
    In @EJB, if the target of the dependency lives within the same application, you can always fully resolve it using only beanName(). beanName() takes the value specified in @Stateless name(), or the default as described above.
    @EJB name() assigns a name to the client dependency within the caller's component environment. It is optional. In most cases that value doesn't matter since if the dependency is being injected you never have to refer to the name() attribute anywhere else.
    @EJB mappedName() is used to resolve an EJB dependency that spans applications. It holds a global JNDI name, e.g. the one specified in @Stateless mappedName(). mappedName() is not required to be supported by all vendors.
    So, to sum it all up, it's fine to have two different beans that expose the same interface. E.g. :
    @Stateless(name="A1", mappedName="A1Global")
    public class A1 implements A { ... }
    @Stateless(mappedName="A2Global") // name() defaults to "A2"
    public class A2 implements A { ... }
    In a caller within the same application :
    @EJB(beanName="A1")
    private A a;
    @EJB(beanName="A2")
    private A a;
    In a caller within a different application :
    @EJB(mappedName="A1Global")
    private A a;
    @EJB(mappedName="A2Global")
    private A a;
    You can find additional information in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#EJB_ejb-ref_ejb_local_ref

  • EJB 3.0 stateless bean + web client (beginner)

    Hello,
    I've just read the Sun tutorial on EJBs in Java EE 5 and I'm trying to get something nice and simple to work. My code is below:
    Bank.java:
    package beans;
    import javax.ejb.Remote;
    @Remote
    public interface Bank {
         public void transfer(long source, long destination, long amount);
    }BankBean.java:
    package beans;
    import javax.ejb.EJBException;
    import javax.ejb.Stateless;
    @Stateless
    public class BankBean implements Bank {
         public void transfer(long source, long destination, long amount)
              System.out.println("This method is not yet implemented.");
              throw new EJBException("Method not implemented.");
    }index.jsp (web project):
    <%!
    private Bank bank = null;
    public void jspInit()
        try {
            InitialContext ic = new InitialContext();
            bank = (Bank) ic.lookup(Bank.class.getName());
        } catch (Exception ex) {
            System.out.println("Couldn't create bean." + ex.getMessage());
    %>Everything compiles with no errors or warnings, but an exception is thrown. The message is "beans.Bank not found".
    I have not modified any .xml files, I don't recall the tutorial saying I have to.
    I'm using Eclipse 3.2 WTP and it doesn't recognize that I have any Session beans... not 100% sure that EJB 3.0 is supported by it. I ended up creating a basic Java project to store the beans because an EJB project was saying that I need at least one bean.
    Thank you in advance for suggestions.
    Pavel

    While looking up why don't you use the fully
    qualified jndi name"java:/comp/ejb...."?
    What's the benefit of that?It's portable. Any direct access of a global JNDI namespace is not portable.
    Also, it's "java:comp/env", not "java:/comp/env".
    >
    Is it possible to use annotations in JSPs?No, annotations are not supported in JSPs for Java EE 5. In the web tier
    they can be used in certain managed classes such as servlets.
    Regarding your original posting, how exactly did you deploy the ejb? If you
    got a message saying the ejb-jar had no ejbs, that sounds like the root of
    the problem. If the ejb-jar only contains a single EJB 3.0 bean and that
    bean uses EJB 3.0 annotations instead of a deployment descriptor, make
    sure there is no ejb-jar.xml. It's possible that Eclipse packaged an
    EJB 2.1 - based ejb-jar.xml descriptor inside the ejb-jar. In that case,
    the app server will assume it is an EJB 2.1 app and not process any
    annotations.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • EJB 3.0  Stateless Local Interface not found

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

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

  • Simple EJB 3.0 stateless session

    Hi,
    I want write a simple EJB 3.0 application on Sun System Java Application Server 9.0 , Can any one help me on the following topic
    1.how should develope a Stateless session.
    2. what are jar files are required
    3. where should place Bean, Business Interface and required files.
    4. Is ejb-jar.xml required. ( As of my knowledge deployement descriptor are not required for EJB 3.0, is it correct)
    5. how should i complie those files.
    6. how should generated RMI components
    If you know any good url on this please help me.
    Thanks, hope excepecting reply soon..

    1.how should develope a Stateless session.write business interfaces and bean classes. I would use an IDE like NetBeans 5.5 to automate some of these tasks.
    2. what are jar files are required You application will need $SJSAS_HOME/lib/javaee.jar
    3. where should place Bean, Business Interface and
    required files.In a jar file, at the root of this jar file. Then you can deploy this ejb jar file to server (using asadmin deploy, admin gui, or autodeploy). The server will scan your jar file and detect it's a ejb jar file and process all metadata.
    4. Is ejb-jar.xml required. ( As of my knowledge
    deployement descriptor are not required for EJB 3.0,
    is it correct)Not required. You can use annotation to provide most or all metadata.
    5. how should i complie those files.For simple cases, use javac should work. For example, javac -classpath $SJSAS_HOME/lib/javaee.jar:. -d /tmp/classes *.java
    But I would suggest using an IDE like NetBeans 5.5, which has various wizards to help you create bean classes and interfaces.
    6. how should generated RMI components
    If you know any good url on this please help me.http://java.sun.com/javaee/5/docs/tutorial/doc/
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • NameNotFoundException EJB 3.0 Stateless Session Bean

    Hi i am new to ejb 3.0 as well as ejb actually. I encountered an error trying out a small stateless session bean application.
    23:15:02,312 ERROR [STDERR] javax.naming.NameNotFoundException: com.afis.ct.ri.session.ejb.ReportIncidentSession not bound
    23:15:02,312 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    23:15:02,312 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    23:15:02,312 ERROR [STDERR]      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    23:15:02,312 ERROR [STDERR]      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
    23:15:02,312 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
    23:15:02,312 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
    23:15:02,312 ERROR [STDERR]      at javax.naming.InitialContext.lookup(InitialContext.java:351)
    23:15:02,312 ERROR [STDERR]      at com.afis.ct.servlets.ri.ValidateIdentityServlet.validateIdentity(ValidateIdentityServlet.java:64)
    23:15:02,312 ERROR [STDERR]      at com.afis.ct.servlets.ri.ValidateIdentityServlet.processRequest(ValidateIdentityServlet.java:35)
    23:15:02,312 ERROR [STDERR]      at com.afis.ct.servlets.ri.ValidateIdentityServlet.doGet(ValidateIdentityServlet.java:19)
    23:15:02,312 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
    23:15:02,312 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    23:15:02,328 ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    23:15:02,328 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    23:15:02,328 ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    23:15:02,328 ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    23:15:02,328 ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    23:15:02,328 ERROR [STDERR]      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    23:15:02,328 ERROR [STDERR]      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    23:15:02,328 ERROR [STDERR]      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    23:15:02,328 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)My remote interface looks like
    package com.afis.ct.ri.session.ejb;
    import javax.ejb.Remote;
    @Remote
    public interface ReportIncidentSession {
         public boolean isIdentityValid(String identity);
    }My bean looks like
    package com.afis.ct.ri.session.ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class ReportIncidentSessionBean implements ReportIncidentSession {
         public ReportIncidentSessionBean() {
              super();
         public boolean isIdentityValid(String identity) {
              return true;
    }Finally i am calling from a servlet which is part of a web application under the same hood(ear) as the ejb jar file.
    InitialContext ctx=new InitialContext();
                   ReportIncidentSession session=(ReportIncidentSession)ctx.lookup(ReportIncidentSession.class.getName());
                                  return session.isIdentityValid(identity);I have done nothing more than making sure there is no compilation error, and i feel some mandatory steps are missing.. So thanks for any help!
    Marvelous.

    Hi DRS, i tried your recommendation and injected the following on top of my servlet class:
    EJB(name="ReportIncidentSessionBean", businessInterface=ReportIncidentSession.class)
    public class ValidateIdentityServlet extends HttpServlet implements
              ValidateIdentity {The original beanInterface you mentioned had an error.
    And upon deployment, JBoss wasn't able to generate a deployment descriptor hinting at the annotations.
    23:50:08,765 ERROR [MainDeployer] Could not create deployment: file:/C:/Program Files/jboss-4.0.4.GA/server/Marvelous/deploy/Avian Flu Information System.ear/Avian Flu Information System Web.war/
    java.lang.UnsupportedOperationException: FIXME: should ignore annotations for missing classes
         at org.jboss.lang.AnnotationHelper.getAnnotations(AnnotationHelper.java:98)
         at org.jboss.lang.AnnotationHelper.getAnnotation(AnnotationHelper.java:75)
         at org.jboss.lang.AnnotationHelper.isAnnotationPresent(AnnotationHelper.java:60)
         at org.jboss.ws.server.WebServiceDeployerJSE.isWebserviceDeployment(WebServiceDeployerJSE.java:152)
         at org.jboss.ws.server.WebServiceDeployer.create(WebServiceDeployer.java:101)
         at org.jboss.ws.server.WebServiceDeployerJSE.create(WebServiceDeployerJSE.java:66)
         at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
         at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy49.create(Unknown Source)
         at org.jboss.deployment.MainDeployer.create(MainDeployer.java:953)
         at org.jboss.deployment.MainDeployer.create(MainDeployer.java:943)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:807)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
         at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy6.deploy(Unknown Source)
         at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
         at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)Your input is greatly appreciated!

  • Stateless SessionBean  Transaction not Rolling Back

    I have a situation to create two Entity Beans within a single Transaction,
              so I created a Session Bean to create the two Entity Beans.
              I have the Session bean with attribute
              <session-type>Stateless</session-type>
              <transaction-type>Container</transaction-type>
              And 2 Entity beans with attributes:
              <persistence-type>Container</persistence-type>
              <trans-attribute>Required</trans-attribute>
              Inside the Session Bean I have a method which calls the create on the two
              Entity Beans.
              create ContactInfo(){
              Phone ph = phoneHome.Create(phoneData);
              Address ad = addressHome.Create(addressData);
              When the secound bean fails to create (Key voilation), my transaction is not
              getting rolled back.
              The Phone Create did not roll back eventhough the address create failed.
              Please give me some suggetion which transaction attributes to use
              I am using Weblogic 6.0
              

    For Create Exceptions , the transactions may or may not rollback. Mostly it
              wont rollback. You have to set the sessionctx.setRollbackOnly() to mark it
              for rollback in the catch block of the Create Exception.
              Regards,
              Swaminathan K.N.
              santo comar <[email protected]> wrote in message
              news:3b8dbb61$[email protected]..
              > I have a situation to create two Entity Beans within a single Transaction,
              > so I created a Session Bean to create the two Entity Beans.
              >
              > I have the Session bean with attribute
              >
              > <session-type>Stateless</session-type>
              > <transaction-type>Container</transaction-type>
              >
              > And 2 Entity beans with attributes:
              >
              > <persistence-type>Container</persistence-type>
              > <trans-attribute>Required</trans-attribute>
              >
              > Inside the Session Bean I have a method which calls the create on the two
              > Entity Beans.
              >
              > create ContactInfo(){
              > Phone ph = phoneHome.Create(phoneData);
              > Address ad = addressHome.Create(addressData);
              > }
              >
              > When the secound bean fails to create (Key voilation), my transaction is
              not
              > getting rolled back.
              > The Phone Create did not roll back eventhough the address create failed.
              > Please give me some suggetion which transaction attributes to use
              >
              > I am using Weblogic 6.0
              >
              >
              >
              

  • Re: Communication between stateless sessionbeans

    Hi,
    Use the Business Delegate pattern to divert the lookup from the Session Bean acting as client. Thus u can execute the method in the Business Delegate java class where u have imported all the paths where all your Session Beans are located.
    I have designed a crude example based on the same concept which are developing. As I'm in the process of adding other EJB's to the Business Delegate pattern, I will post the code here in a couple of days.
    If u solve the same before I do, let me know.
    HTH,
    Seetesh

    Hi,
    Thanks for ur attention and reply to my quetion.
    But i can not understand what u want to say,
    Can u pls give answer in detail and if possible with example???
    thankx again.
    rgds ,
    Ashish

  • Call servlet through stateless sessionbean

    can any body help me about.....
    code to call(run) servlet through stateless session bean,
    how can develop it using URL class..
    please help me............

    Hi
    it can be possible if your session bean  can call servlet through an protocol.
      means you can create an URL or URL connection class and call it through http protocol.
    i .e we can create URLConnetion ( HttpURLConnection ) object to that servlet  from a session bean.
    I hope this will help you some extent to solve your probs.
    Thanks
    Mrutyunjaya Tripathy

  • Trying to talk RMI from 10.3 to 8.1 thru WebService - Nasty Exception

    Hi All,
    as an aside.. Somehow my account got reset? and i cannot change my username back... how and ever...
    I'm having a meltdown over an issue between a 10.3 Weblogic Server and an 8.1 Weblogic Server
    Bascially I have a JAX-WS 2.0 Web Service running on 10.3, Java 6 , calling into a EJB3 Session Bean, which instantiates an RMI ServiceLocator to another System running EJB 2.1, Java 1.4 on Weblogic 8.1
    As soon as the InitialContext lookup is performed, i get the error below.
    This ONLY happens when calling through the JAX-WS Webserivce. I can retrive records via direct RMI call to the SessionBean just fine.
    Has anyone ANY idea what causes this (is it something to do with JAXWSClassLoaderFactory)? And how i might fix it?
    Alternatively, if there is a way around it.... i'd take that too. I have to stick with exposing this as a webservice though.
    Thanks in advance,
    Mike
    Configuration
    EJB Exception: : weblogic.utils.AssertionError: ***** ASSERTION FAILED *****
    Could not find dynamically generated class: 'merryman.queryservice.GenericQueryService_3n7zjk_HomeImpl_816_WLStub' at
    weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:78) at
    weblogic.rmi.internal.StubGenerator.hotCodeGenClass(StubGenerator.java:775) at
    weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:759) at
    weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:786) at
    weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:779) at
    weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:74) at
    weblogic.rmi.internal.StubInfo.resolveObject(StubInfo.java:213) at
    weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:207) at
    sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source) at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at
    java.lang.reflect.Method.invoke(Method.java:597) at
    java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061) at
    java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762) at
    java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at
    java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at weblogic.utils.io.ChunkedObjectInputStream.readObjectFromPreDiabloPeer(ChunkedObjectInputStream.java:221) at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:562) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193) at
    weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62) at
    weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240) at
    weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348) at
    weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259) at
    weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source) at
    weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392) at
    weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380) at
    javax.naming.InitialContext.lookup(InitialContext.java:392) 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:597) at
    com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:15) at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54) at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:30) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126) at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114) at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
    at $Proxy119.getRecords(Unknown Source)
    merryman.ejb.session.DbSessionBean_qfyvi8_DbSessionBeanLocalImpl.getRecords(DbSessionBean_qfyvi8_DbSessionBeanLocalImpl.java:470) at merryman.webservice.PortalServices.getRecordsForKey(PortalServices.java:106) 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:597) at
    weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:89) at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:71) at
    com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146) at
    com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93) at
    com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557) at
    com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243) at
    com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444) at
    com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244) at
    com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134) at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:272) at
    weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:185) at
    weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:180) at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
    weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:64) at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at
    weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) at
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at
    weblogic.security.service.SecurityManager.runAs(Unknown Source) at
    weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406) at
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at
    weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassNotFoundException: merryman.queryservice.GenericQueryService_3n7zjk_HomeImpl_816_WLStub at
    weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283) at
    weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54) at
    java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176) at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35) at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:82) at weblogic.wsee.util.JAXWSClassLoaderFactory$1.findClass(JAXWSClassLoaderFactory.java:44) at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:67) at
    weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:62) at
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at
    java.lang.Class.forName(Class.java:247) at weblogic.utils.classloaders.GenericClassLoader.defineCodeGenClass(GenericClassLoader.java:507) at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:73) ... 88 more

    Did any one find the solution or workaround for this?
    I am having a similar scenario,
    jax-ws deployed in 10.3 server calls EJB 2.0 Stateless SessionBean deployed in another 10.3 server.
    Thanks,
    Jey
    Edited by: user8803553 on Jul 27, 2010 6:43 AM
    Edited by: user8803553 on Jul 27, 2010 6:50 AM

Maybe you are looking for

  • How can you get a refund on your mac?

    Help me please!

  • RFC Adapter - program ID

    Hi Gurus, I like to know in RFC sender adapter we have given a program id,( a function module ) 1) Is this function module  in R/3 or in XI. 2) Is it possible to give BAPI in Program ID of sender RFC Adapter Regards Manan

  • Camera app only shows still camera option. Video option is gone

    The iphone 4 camera app intermittently would not open. Now the video option does not show at all. Still takes photos but no way to get to video mode. And the answer is? John

  • Need help on incremental backup

    Hi, I am running a rman backup using 10g DBCONSOLE. I selected level 0 backup and it's running. this is the command. >> backup incremental level 0 cumulative device type disk filesperset = 5 tag 'BACKUP_DHAVA.SOS.S_081507014538' database; >> my quest

  • Help - photo could not be opened, because the original item cannot be found

    I keep getting the following error message for about 10 different photos:  "The photo "IMG_0123.JPG" could not be opened, because the original item cannot be found."  It prompts to cancel or find these photos every time I open iPhoto.  Is there any w