Ejb 3  stateless session bean eclipse glassfish runtime error

trying to get a simple stateless session ejb 3 connected to a jsp using eclipse and glassfish. I have the two projects compiling, deploying, and in archives. but i am getting an error in my jsp which states it can't find my 'ejb' package which holds my created class files. I have looked at many examples on line and I can't find anything to point me in the right direction. please help!

So you have 1 war file deployed and 1 ejb module deployed. Does the war file contain the interface class of the ejb? When deploying I tend to create a separate jar containing the interfaces to the ejbs that my web app will use and add it to WEB-INF/lib.
Also post the stack trace of the Exception you are getting in case there is somthing else in it. (Just the juciy bits - I know how big Glassfish stacks can be!)
m

Similar Messages

  • A tough one for EJB experts - Stateless session bean spec question

    I am busy learning more about EJBs and came across something confusing regarding the legal operations in the various container callback methods for stateless session beans.
    Specifically, the EJB spec states that in the ejbCreate() method, the SessionContext can be used to obtain a reference to the EJB Object. Now this makes perfect sense with stateful session beans, since the ejbCreate() method isn't called until a client is creating a bean and the container has linked that bean to the client's EJB Object. However, it is my understanding that when it comes to stateless session beans, the container creates the beans and adds them to the bean pool at its leisure. It is not until a business method is called by a client that a stateless bean is actually linked to an EJB object. So, how is it that a stateless bean could ever obtain a reference to an EJB Object from within ejbCreate(). Which EJB Object would it be linked to? This operation just doesn't appear to make sense in that context.
    Can anyone clarify this for me?

    Interesting question. I have such questions all the time! Here's a link to a similar discussion
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=70&t=000905
    Also, I tried this using Weblogic 8.1. Tried to access the EJBObject in ejbCreate before any business method was invoked. I did this by specifying a value for initial-beans-in-free-pool and found that the hash code for the EJBObject was the same for all the bean instances that were created on startup.
    I then invoked a business method and accessed the EJBObject in that method. Again the hash code for the object was the same as the one created on startup.
    Seemed to be that there is a 1:n relation between the EJBObject and bean instances.
    This may be container specific. The spec says the user should be able to invoke the getEJBObject() method in ejbCreate(), its upto the container to comply with it.

  • Problem Deploying EJB3 Stateless session bean in Jboss4.0.3

    Hi All,
    I have developed an EJB 3 Stateless session bean and tried to deploy in JBoss 4.0.3 , But i get the following Exception.
    javax.naming.NameNotFoundException: ejb not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at org.apache.jsp.session_jsp._jspService(org.apache.jsp.session_jsp:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:157)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    I am sorry if the question is silly..... My Remote Interface will be one like this
    import javax.ejb.Remote;
    @Remote
    public interface CityService {
         public String getCity();
    And My Bean Class will be
    import javax.ejb.EJB;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityTransaction;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @EJB
    @Remote(CityService.class)
    @Stateless(mappedName="ejb/CityService")
    public class CityServiceBean implements CityService {
    public String getCity(){
    return "Chennai Metropolitan";
    And the client which invokes the bean will be
    InitialContext ctx = new InitialContext();
    CityService c = (CityService)ctx.lookup("ejb/CityService");
    System.out.println("Msg from Bean"+c.getCity());
    please help me out of this issue....
    Thanks in advance

    ford wrote:
    If you deploy your application in a .ear, you also can use this:
    You have to set a name to your EJBBean -> @Stateless(name = "XXX")
    The client for remote interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Remote");
    The client for local interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Local");the problem with this approach is that if you version your ears, the version numbers show up in the jndi names, and your client code will be hard coded to specific server versions.

  • EJB 2.1 session bean calling EJB 3 session bean?

    I have a WL 10 (JDK 1.5/EE 5) server that has several EJB 3 stateless session beans deployed and working well. But now I need to allow a JBoss 3.2.3 (JDK 1.4) EJB 2.1 session bean make remote calls into these EJB 3 EJBs. Can this even work?
    It seems to me that EJB 3 calling EJB 2 would be fine, but not in the reverse?

    I have a WL 10 (JDK 1.5/EE 5) server that has several EJB 3 stateless session beans deployed and working well. But now I need to allow a JBoss 3.2.3 (JDK 1.4) EJB 2.1 session bean make remote calls into these EJB 3 EJBs. Can this even work?
    It seems to me that EJB 3 calling EJB 2 would be fine, but not in the reverse?

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

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

  • Call stateless session bean EJB 2.0 from Webdynpro Java UI

    Hello,
    Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
    The NWDS version is 7.0.
    Thanks and Regards,
    Arya

    Hi Aryadipta
    Please check this pdfs
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
    Steps for calling stateless session bean in Webdynpro java
    Go to NWDS -> open perspective ->j2ee
    select EJB Module Project ->create a project with name
    Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
    Give name to EJB Bean (First letter should be in capital letters)
    select the type of bean as Stateless session bean and give the package name to store that EJB bean.
    After that Expand ejb-jar.xml and then select the <projectEJB> 
    Double click on this on method  tab double click you will get business method where we will create the methods for business logic
    Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
    After writing the business logic go to project -> rebuild
    Till now we have created one EJB jar file
    then go to File-->Enterprise Application Project -->create a project (projectEAR)
    After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
    After that Calculate EAR project will be available on j2ee explorer.
    Right click on <Bean> here
    select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
    -->click next -> Finish.
    That webservice and related are created in ejb-jar.xml .
    Expand the ejb-jar.xml.and double click on < webservice>
    RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
    Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
    Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
    select the specific WebService  
    Here we test the webservice by click on Test and test it.
    After that go to Web dynpro perspective ->create one webdynpro Project and one component
    RC on model> Select import Web Service model(last)>give model name and package
    and select radio button as local file system or URL
    Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
    from here onwards steps are same as that adaptive RFC model
    Hope it helps
    Thanks
    Tulasi Palnati
    Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
    Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM

  • Stateless Session Bean + EJB Question + Jboss

    Hello,
    If I have a stateless session bean on a linux machine and it works locally what do i need to do to access a method in the session bean from a remote windows machine.
    I would like to be able to execute my client jar file on a windows machine and have it access the jboss server on the linux machine. what do i need to do?
    i have the session bean working locally on both windows and linux machine. do i need to to have a JSP/Servlet to access the session bean? can the session bean not be accessed directly? what should my classpath look like? do I need to include extra jar files in my client jar file.?
    Thanks,
    Joyce

    Thanks guys for the help but I am still a little lost.
    My Client windows machine has the client jar file and all the other jar files. This is my client class
    package helloworld.client;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    import java.util.Properties;
    import helloworld.interfaces.HelloWorldHome;
    import helloworld.interfaces.HelloWorld;
    public class HelloClient
         public static void main(String[] args)
              Hashtable prop = new Hashtable();
              prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
              prop.put ("java.naming.provider.url","jnp://172.16.220.160:1099");
              prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
              try
                   Context ctx = new InitialContext(prop);
                   Object obj = ctx.lookup("ejb/helloworld/HelloWorld");
                   System.out.println(obj);
                   HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
                   HelloWorld helloWorld = home.create();
                   String str = helloWorld.sayHelloEJB("JOYCE is COOL");
                   System.out.println(str);
                   helloWorld.remove();
              catch(Exception e)
                   e.printStackTrace();
    I get a NullPointer ie the home object is null. The IP address is the IP of the Linux machine that has Jboss running on.
    Questions are:
    1. Do I need to have Tomcat running on my client machine if I am to connect via HTTP? Does this alter my client code.?
    2. My JNDI lookup is what is causing the problem. Does my jboss.xml and my ejb-jar.jar look okay to you.
    jboss.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>helloworld/HelloWorld</ejb-name>
    <jndi-name>ejb/helloworld/HelloWorld</jndi-name>
    </session>
    </enterprise-beans>
    <resource-managers>
    </resource-managers>
    </jboss>
    ejb-jar.jar
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description>No Description.</description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[No Description.]]></description>
    <ejb-name>helloworld/HelloWorld</ejb-name>
    <home>helloworld.interfaces.HelloWorldHome</home>
    <remote>helloworld.interfaces.HelloWorld</remote>
    <ejb-class>helloworld.session.HelloWorldBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
    </session>
    <!--
    To add session beans that you have deployment descriptor info for, add
    a file to your merge directory called session-beans.xml that contains
    the <session></session> markup for those beans.
    -->
    <!-- Entity Beans -->
    <!--
    To add entity beans that you have deployment descriptor info for, add
    a file to your merge directory called entity-beans.xml that contains
    the <entity></entity> markup for those beans.
    -->
    <!-- Message Driven Beans -->
    <!--
    To add message driven beans that you have deployment descriptor info for, add
    a file to your merge directory called message-driven-beans.xml that contains
    the <message-driven></message-driven> markup for those beans.
    -->
    </enterprise-beans>
    <!-- Relationships -->
    <!-- Assembly Descriptor -->
    <assembly-descriptor >
    <!-- finder permissions -->
    <!-- transactions -->
    <!-- finder transactions -->
    </assembly-descriptor>
    </ejb-jar>
    Do I need RMI ? Do I need to concern myself with CORBA? All Im looking for is a step by step to understanding what I need to configure? Is their some way I can debug?
    Thanks alot,
    Joyce

  • 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 session Bean - xml and ejb-jar.xml file ???

    Dear Experts,
    Stateless-session bean
    For Creating an ear file
    we need ejb-jar.xml and weblogic-ejb-jar.xml files
    Is these files are already available
    or we have to type these files ??
    Advance Thanks
    Rengaraj.R

    My best advice: surrender to use an IDE.
    You wonder sometimes at how much productivity (read as 'time') could be wasted by doing something that could be done automatically. For a learning experience or a once only exercise is fine but as a routine thing, not worth it.
    Cheers

  • Paradox - Should entity CMP EJB be faster than stateless session bean?

    Please bear with me on this.
    Just thinking of this scenario: hello world application. It can be implemented both as stateless session bean and entity bean.
    There's no persistent. So for the entity bean, it will be container managed, and no code to do anything to the load/remove/create. - comparably the same as stateless bean.
    Next, for the stateless session bean, each client call would require a dedicated instance of the EJB on the server (although for a very short amount of time). For the entity bean, it's shared, so only 1 instance is needed. It's also thread safe.
    So, for a very high traffic, shouldn't the entity bean do better because of single instance?
    What's other overhead?
    Does the entity bean cost more connections than the stateless bean?

    Feels like a comparison between apples and oranges.
    A stateless session bean is like every other instance, so these can be pooled by the EJB container. The container is free to create an instance for each client if necessary. That's different.
    A stateless session bean doesn't have to deal with a database that may or may not be located on another machine the way an entity bean does. There could be another network round trip involved. That's different.
    Session and entity beans are intended for entirely different purposes. Just because you can write Hello World with both doesn't mean it's representative of what EJBs are used for. I don't think it's a good, meaninful comparison. JMO - MOD

  • What's s the best automated route from stateless session bean class to EJB?

    Hi,
    I have an application that generates stateless session bean classes.
    For any given stateless session bean class, I would like to build an EJB, moreover, I would like to automate the process as much as possible.
    I'd rather not rely on a full blown third party IDE.
    I reckon could write a set of java classes that could analyse the session bean class and generate the home and remote interface and a basic deployment descriptor.
    That said, I have no doubt that I would be renventing the wheel.
    But I am struggling to find a utility/class of the appropriate granularity in the public domain.
    I am wide open to any feedback on approaches people may have taken and the pros and pitfalls.
    I fully realise my question is quite unspecific, but I really wanted to get some feedback and start a discussion. Since, I am sure there is no 'correct' answer.
    Most kind regards,
    Simon.

    My best advice: surrender to use an IDE.
    You wonder sometimes at how much productivity (read as 'time') could be wasted by doing something that could be done automatically. For a learning experience or a once only exercise is fine but as a routine thing, not worth it.
    Cheers

  • Registering EJB/Stateless Session Bean Web Service in Registry

    Hi verybody!
    I would like to know how I can register a Web Service in a registry. The web service is implemented as a session bean.
    The problem is not the actual code to register the service, but how and where can I hook this code into the application so that it is started when the application server is started.
    I've read the Sun J2EE tutorial which registered the service in the moment when the context for the servlet for an ordinary web client was created. This is not what I want. I would like to register the service when starting the EJB container, without the need to give it a kick from some external interface.
    Any help or ideas will be greatly welcome
    Regards
    PI

    1. But I thought you were using a 'stateful session bean'?
    2. For stateless session beans, there is no direct link between a remote reference and an instance of the bean. It is safe to hang on to the remote reference as long as you would like, of course it may go stale if the server dies. You will also find that the create() method does not actually contact the server, so doing it each usage costs very little. So, either way you should be fine.
    3. As for memory leaks, make sure that you are closing all statements, result sets, etc. promptly. These are commonly the problem. Also, use hprof or some other profile tool to determine what types of data you are allocating and (with better tools) what types of data you may be holding on to references to.
    Chuck

  • J2EE EJB stateless session bean lifecycle

    Hi all,
    I've developed a stateless session bean to manage starting/stopping a JCo server.
    What should I do in order to achieve these goals:
    1. The stateless session bean should be created when the SAP J2EE server is started.
    2. The stateless session bean may NEVER 'die'.
    Thanks,
    Jeroen

    hi
    good
    1-
    go through these links, which ll give you the idea how to crea the stateless bean.
    http://edocs.bea.com/wle/ejbsamp/stateles.htm
    http://www.sitepoint.com/print/implement-first-ejbs
    2-
    http://home.tiscali.nl/illuminate/scbcd/My%20SCBCDE%20Study%20Notes%20-%204%20Session%20Bean%20Lifecycle.htm
    thanks
    mrutyun^

Maybe you are looking for