Calling EJB 3.1 deployed in Glassfish 3.1 from  a web app in Tomcat7

I have a EJB 3.1 bean deployed in Glassfish 3.1.1 server. I want to call this bean from a remote web client deployed in Tomcat 7. The EJB class and its remote interface is as follows ...
Remote Interface -
@Remote
public interface MyEJBRemote
public String sayHello();
EJB Bean -
@Stateless
public class MyEJB implements MyEJBRemote
public String sayHello()
return "Hello EJB Client. Hope everything worked just fine.";
In the remote client I have the following code
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ic = new InitialContext(props);
MyEJBRemote myEJBREmote = (MyEJBRemote)ic.lookup("java:global/MyEJB-1/MyEJB!com.dw.ejb.MyEJBRemote");
Now the problem is with the last line of code. In Eclise this line of code is marked as error as the MyEJBRemote class is not there in the client project (the web app going to be deployed in tomcat 7). So where do I get the client jar generated from the deployed EJB to include in the client project ? Is there any way to generate this jar file.
I tried using the glassfish command
asadmin deploy generatermistubs retrieve . MyEJB.jar
But glassfish didn't not generate any MyEJB-client.jar file. I tried a lot of times but without any success. I read up many forums. In one of them, it was mentioned that from EJB 3.1 glassfish does not generate the client stubs.
So does that mean that one cannot use remote clients from EJB 3.1 in Glasssfish anymore ? Because the client project will never compile without the MyEJB-client.jar .

You don't have to generate anything, you need the business interface class in your client application (MyEJBRemote in this case). One way to do that is to put the business interfaces in a separate jar and link that jar in both your client and server projects. The glassfish 3 FAQ documents the need to include the business interface class in your client application:
http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
Another option is to turn the EJB into a JAX-WS webservice, which can be as easy as only adding a few annotations to it. That way you don't need any additional dependencies at all; the only thing you need to do is generate the stub classes using the wsimport tool (also part of the JDK) for your client application. I'm not a huge fan of SOAP, but for internal use I find it less cumbersome and more portable than remote EJBs.
I can't offer any more advice on the topic as I don't use Glassfish. For better help, I do advise you to ask in the Glassfish forum where you'll find more people that have been in the same boat you are.
http://www.java.net/forums/glassfish/glassfish

Similar Messages

  • How to connect to remote EJB 3.0 deployed on Glassfish from ADF application

    Hello, as we haven't managed to deploy ADF app with EJB 3.0 on Glassfish AS, nor on tomcat 6 with openEJB, nor on JBOSS 5GA, we're trying to deploy our app with remote interface on tomcat 6. We're using ADF, JSF and EJB 3.0 (Eclipselink as JPA).
    When the model project is deployed on WLS 10.3, everything works fine. Here is a part from DataControls.cpx
    <Source>
    <ejb-definition ejb-version="3.0" ejb-name="MySession"
    ejb-type="Session"
    ejb-business-interface="model.MySession"
    ejb-interface-type="remote"
    jndi-name="MySessionBean#model.MySession"
    provider-url="t3://localhost:7001"
    initial-context-factory="weblogic.jndi.WLInitialContextFactory"
    xmlns="http://xmlns.oracle.com/adfm/adapter/ejb"
    DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"/>
    </Source>Now the model project is deployed on Glassfish 2. I had to change DataControls.cpx
    <Source>
    <ejb-definition ejb-version="3.0" ejb-name="MySession"
    ejb-type="Session"
    ejb-business-interface="model.MySession"
    ejb-interface-type="remote"
    jndi-name="MySessionBean#model.MySession"
    provider-url="iiop://localhost:3700"
    initial-context-factory="com.sun.enterprise.naming.SerialInitContextFactory"
    xmlns="http://xmlns.oracle.com/adfm/adapter/ejb"
    DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"/>
    </Source>But I get the following error:
    SEVERE: Exception:
    oracle.jbo.JboException: JBO-29000: Выявлено непредвиденное исключение: javax.naming.NameNotFoundException, сообщ.=Exception in lookup.: `DocJournalService' could not be found.
         at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:171)
         at oracle.adfinternal.model.adapter.ejb.EjbDefinition.createDataControl(EjbDefinition.java:142)
         at oracle.adf.model.adapter.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:173)
         at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:166)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.naming.NameNotFoundException: Exception in lookup.: `DocJournalService' could not be found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
         at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:58)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:252)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:230)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:148)
         ... 60 more
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
         at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:241)
         ... 63 more
    ## Detail 0 ##
    javax.naming.NameNotFoundException: Exception in lookup.: `DocJournalService' could not be found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
         at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:58)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:252)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:230)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at oracle.adfinternal.model.adapter.ejb.EjbDataControl.<init>(EjbDataControl.java:148)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
         at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
         at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:241)
         ... 63 more
    Could you tell me where is my mistake?

    http://www.alexnet.fr/doc/oracle/oas10132/web.1013/b28221/undejdev003.htm

  • Access EJB 3.0 (deployed on Glassfish v3) from Tomcat 6.0.20 (Netbeans 6.8)

    Hi all,
    I'm a newbie (of java EE and Sun forum).
    I have a problem.
    I followed this tutorial: http://technology.amis.nl/blog/1368/connecting-to-an-ejb-30-remote-sessionbean-from-tomcat
    using Netbeans 6.8, Tomcat 6.0.20, Glassfish v3.
    The deploy of EJB on Glassfish is OK.
    The deploy of WebApp on Tomcat is OK.
    But when I access to the servlet using the browser I receive this exception.
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at web.MyServlet.processRequest(MyServlet.java:51)
    at web.MyServlet.doGet(MyServlet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:619)
    I know that I must copy *.jar files in Tomcat dir and App libraries (https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#Step_3._Include_appserv-rt.jar_and), but it doesn't work.
    What are my mistakes?
    Thank you for your help.
    Servlet code:
    package web;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.util.Properties;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import testbean.MySessionBeanRemote;
    * @author Stefano
    public class MyServlet extends HttpServlet {
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
    props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
    props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
    props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
    props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet MyServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println(MySessionBeanRemote.class.getName());
    try {
    InitialContext ic = new InitialContext(props);
    MySessionBeanRemote mySessionRemote = (MySessionBeanRemote) ic.lookup("pippo");
    out.println(mySessionRemote.getOK());
    } catch (NamingException ex) {
    ex.printStackTrace();
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();

    Yes, I did.
    I'm not sure about the right actions to do.
    For example: the Glassfish FAQ told me to add gf-client*.jar to the Tomcat folder, not appserv-rt.jar , with v3.
    I tried with both files. I restarted Tomcat, but nothing work :-(

  • Calling EJB deployed on Weblogic 10.3 from WebSphere Application Server 6

    Hi,
    We are trying to call an EJB(2.1) deployed in Weblogic 10.3 from WebSphere Application Server 6.
    The problem is that the jars containing Weblogic's initial context factory are compiled with JDK5. (Client jar was built as per [http://download.oracle.com/docs/cd/E15051_01/wls/docs103/client/jarbuilder.html] .)
    WebSphere is still running on JDK1.4.
    Therefore when trying to get the InitialContext to lookup up the bean we get major/minor version errors because of the compiler level mismatch.
    Has anyone faced a scenario like this and come up with a solution?
    Are there 1.4 jars for Weblogic 10.3 out there?
    Any help?
    Thanks

    Hi Dan,
    Yes I am using EJB 3. I saw this thread earlier also but :
    1. In my case I am not calling the EJB 3.0 methods directly. I am using a java client (Cataloged as a Java Class Library) which does the lookup and calls the EJB methods. (I am not cataloging and calling the EJB 3.0 methods directly).
    2. It is working perfectly fine when the EJB is deployed in Weblogic 10.0 or 10.2.
    I am very much new to this so please bear with my small and silly questions! Thanks a lot for you help !
    Cheers !
    Rajat

  • What setting is needed to call ejb in jsp with deployment tool ?

    my application myApp.ear have files myEjb.jar , myClient.jar and detail.war
    I have added EJB ref on my ejb.
    I have added myEjb.jar to lib directory of detail.war
    Any thing I miss?
    Thanks for any help!

    In order to be able to access an EJB from the web app, you need to declare the reference to that EJB (remote or local) in the deployment descriptor of your web app (web.xml).

  • ClassCastException JMX calling EJB

    Hello,
    Could someone help me understand a ClassCastException that seems related to my using JMX?
    I have an EJB in application A with a method returning a user-defined type. I call this method successfully from a Web-app in application B. (The Web-app is simply a hook for initialization - creating and registering an MBean. The test call is a method call in the MBean object, invoked from its own constructor).
    But I really want to call this MBean via JMX (from outside the server). When I do this I get ClassCastException in the EJB stub when the user-defined type is returned.
    The class for the return type is in a jar packed in the web-app. I have also tried putting that jar in APP-INF/lib.
    I have verified that the MBean object and its class-loader object are the same in the failure case as in the success case.
    I'm using WL Server 8.1SP1 on Linux.
    Thank you,
    Ken Ward

    Hi, thanks for the quick reply.
    My client is a Jython script that uses getAdminMBeanHome(), then getMBeanServer() on that.
    This code gets the MBeanServer to register with:
    public static javax.management.MBeanServer getInstance() {
    weblogic.management.MBeanHome mbh =
    weblogic.management.Helper.getMBeanHome(WeblogicGlobals.getManagementUserName(),
    WeblogicGlobals.getManagementPassword(),
    WeblogicGlobals.getServerUrl(),
    WeblogicGlobals.getServerName());
    weblogic.management.RemoteMBeanServer rmbs = mbh.getMBeanServer();
    // System.out.println("WeblogicAppserverMBeanServer: " + rmbs);
    return rmbs; // upcast
    Here's the trace. MOResponse is the user-defined class returned from the EJB. XppProxyImpl is the EJB client - it is called by XppService, the MBean.
    java.lang.ClassCastException: com.wildfire.nf.oamp.am.mo.MOResponse
    at com.wildfire.nf.oamp.am.beans.MORequestDispatcherSBean_wwnnxe_EOImpl_811_WLStub.handleRequest(Ljava.lang.String;)Lcom.wildfire.nf.oamp.am.mo.MOResponse;(Unknown Source)
    at com.wildfire.nf.oamp.am.client.XppProxyImpl.sendRequest(Ljava.lang.String;)Ljava.lang.String;(XppProxyImpl.java:44)
    at com.wildfire.sam.mgmt.am.XppService.sendRequest(Ljava.lang.String;)Ljava.lang.String;(XppService.java:31)
    at COM.jrockit.reflect.NativeMethodInvoker.invoke0(ILjava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Native Method)
            at COM.jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
            at COM.jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
            at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
            at com.sun.management.jmx.MBeanServerImpl.invoke(Ljava.lang.Object;Ljava.lang.String;[Ljava.lang.Object;[Ljava.lang.String;)Ljava.lang.Object;(MBeanServerImpl.java:1630)
            at com.sun.management.jmx.MBeanServerImpl.invoke(Ljavax.management.ObjectName;Ljava.lang.String;[Ljava.lang.Object;[Ljava.lang.String;)Ljava.lang.Object;(MBeanServerImpl.java:1525)
            at weblogic.management.internal.RemoteMBeanServerImpl.invoke(Ljavax.management.ObjectName;Ljava.lang.String;[Ljava.lang.Object;[Ljava.lang.String;)Ljava.lang.Object;(RemoteMBeanServerImpl.java:765)
            at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(ILweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;Ljava.lang.Object;)Lweblogic.rmi.spi.OutboundResponse;(Unknown Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic.rmi.extensions.server.RuntimeMethodDescriptor;Lweblogic.rmi.spi.InboundRequest;Lweblogic.rmi.spi.OutboundResponse;)V(BasicServerRef.java:466)
            at weblogic.rmi.internal.BasicServerRef$1.run()Ljava.lang.Object;(BasicServerRef.java:409)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(AuthenticatedSubject.java:353)
            at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedExceptionAction;)Ljava.lang.Object;(SecurityManager.java:144)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(Lweblogic.rmi.spi.InboundRequest;)V(BasicServerRef.java:404)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(Lweblogic.kernel.ExecuteThread;)V(BasicExecuteRequest.java:30)
            at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:197)
            at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:170)
            at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    I'll follow your suggestions and try to dig up more.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Issues in looking up a ejb deployed on glassfish from tomcat.

    Hi all,
    I have followed the steps mentioned in the EJB FAQ in the glassfish site and was able to lookup a remote ejb deployed in glassfish from a standalone client.
    In case of standalone client, i set the appropriate jndi properties in the initial context as mentioned in the FAQ and added the 4 jars specified to the classpath of the application.
    It all worked perfectly well.
    But I attempted to do the same from a servlet running under tomcat.
    I set the appropriate jndi properties in the intial context and added 4 jars specified in the lib directory of the war file.
    But this did not turn out well and tomcat complained me with some servlet init errors.
    Then i searched through the web and found this posting from you:
    http://www.archivesat.com/GlassFish_Enterprise_JavaBeans_Developers/thread1399339.htm
    Then i created a folder called "shared/lib" under TOMCAT_HOME directory in my machine and ran the same example. Wow.....miraculously the application ran well.
    But i found that the "index.jsp" which i configured in the welcome file list does not appear now. But i was able to access the servlet without any problem. And the servlet was able to successfully lookup the ejb deployed in glassfish.
    Then i thought, let me try to access the ejb from a jsf application.
    Then i created a jsf application in netbeans 5.5.1 and tried to access the bean deployed in glassfish.
    (Note: the jsf application runs in tomcat 5.5.17 which is bundled with netbeans)
    OOPSS....
    Tomcat now complains me that it cannot compile the jsp page..
    This is the error i got...
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:7: org.apache.jsp.index_jsp is not abstract and does not override abstract method getDependants() in org.apache.jasper.runtime.JspSourceDependent
    public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
    ^
    Generated servlet error:
    C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:12: getDependants() in org.apache.jsp.index_jsp cannot implement getDependants() in org.apache.jasper.runtime.JspSourceDependent; attempting to use incompatible return type
    found : java.lang.Object
    required: java.util.List
    public Object getDependants() {
    ^
    2 errors
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    Any ideas...
    Can you please help me.
    I've noticed that you were eagerly answering questions related to ejb lookup in many places.
    I feel there is some potential compatability issue between tomcat and glassfish...
    I request you to investigate on this and clarify the community with your response.
    Thanks in advance,
    James Selvakumar

    Thank you guys!
    I've found the answer myself.

  • Doing a jndi lookup() for an EJB deployed on Glassfish v3

    Hello.
    I have deployed a Stateful Sesion EJB on a Glassfish v3 AppServer.
    It is running under 'localhost' on my laptop pc.
    I am also running a stand-alone java application on the same pc... it attempts to get a remote connection from the client-app to the Glassfish Server and then do a jndi lookup() to get a reference to my EJB.
    here is the client source code:
    public class LookupTest {
    static Properties props = null;
    public static void main(String[] args) {
    try {
    props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
         props.put(Context.PROVIDER_URL, "iiop://localhost:3700");
         Context ctx = new InitialContext(props);
         System.out.println( "the context is: " + ctx);
         System.out.println( "the environment contains: " + ctx.getEnvironment() );
         System.out.println( " ");
         // do a lookup.
         Object elementObj = ctx.lookup("SerialContextProvider");
         System.out.println(elementObj);
    } catch (NamingException e) {
    e.printStackTrace();
    When I run this app, there are no Errors or Exceptions. It appears that the connection succeeds. But there are no EJB references in the context that is created. The only item that seems to be present in the context is an item named "SerialContextProvider", as noted in the return value from a list("") method invocation. Why can i not see the EJB within the context? Is my code wrong ??
    Thanks,
    Andy Jerpe
    Edited by: user1169567 on Nov 28, 2010 12:12 PM

    Ok, but the communication seems to be OK over the wire because if I use netstat -a I can see the ESTABLISHED connection with the server in the right RMI port.
    TCP PORTAL35:1581 caapiranga:12405 ESTABLISHED
    and then when I stop the instance in the OAS, the client shows an exception telling that the connection was lost.
    An curious thing is that the ons.log doesn't log this connection ;/

  • How to call EJB deployed on OC4J from java stored procedure?

    Hello,
    I'd like to call EJB from java stored procedure. My example works fine from command line, but the problem seems to be with deployment of this code into database. Especialy I'm wondering how to reference jars like oc4jclient.jar, ejb.jar, ... from java stored procedure.
    Is there some example how to do that ?
    Can You help me please ?
    Many thanks,
    Radim Kolek,
    Eurotel Prague.

    Hi,
    You may want to check up this thread
    Calling JBoss EJBs from Java stored procedure
    Hope this helps,
    Sujatha.
    OTN Group.

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

  • How to call webservices deployed in Oracle edentity server from BPEL .

    my application requires to call a web service which is deployed on the OES server. This web service will accept user name and password as paremeter and rerurn true if the user is a valid user .

    You can try to right click on the EJB in JDeveloper and choose "create test client", then choose the connection you used for deployment and it should create a client for you that can access the EJB.

  • WDP calling EJB and passing objects of classes from Java project

    Hi.
    We have <b>Java</b> project which contains some classes common for all projects (like xxx.Version).
    We have <b>EJB</b> project which defines EJB interface using these common classes (like getVersion(String,int): xxx.Version and getCurrency(String,xxx.Version,int):xxx.Currency ).
    We have <b>Web Dynpro</b> project which calls EJB:
    1. Lookup is successful
    2. call to getVersion is successful
    3. call to getCurrency fails with <b>NoSuchMethodException</b>:
    xxx.XXXObjectImpl0.getCurrency(java.lang.String, xxx.Version, int)
         at java.lang.Class.getMethod(Class.java:986)
         at com.sap.engine.services.rmi_p4.reflect.LocalInvocationHandler.invokeInternal(LocalInvocationHandler.java:51)
         at com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:53)
         at $Proxy346.getCurrency(Unknown Source)
         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 com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy347.getCurrency(Unknown Source)
         at xxx.XXX.getCurrencyWrapper(XXXXX.java:24)
    How can I set dependencies to get this running?
    Thanks to all
           Volker

    Hi,
    Is it available in the interface you are using..
    If the answer is yes.. you might have probably forgotten to deploy the EJBs ear file after making the changes..
    Rebuild it.. and deploy the EJB s ear file again..
    It will solve the problem.. If that also does not work,it might be a problem with the cache.. restart the server..
    It should work now !
    Regards
    Bharathwaj

  • How can I call EJB from JSP/Servlets in iWS?

    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

    Park,
    Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
    reason,
    look at the Converter sample from iAS. You will be doing RMI/IIOP in this
    case and the sample explains in detail what to do.
    hth,
    -robert
    "SungHyun, Park" <[email protected]> wrote in message
    news:9jpfmt$[email protected]..
    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

  • Call ejb from browsers

    Hello Developers!
    I deployed my ejb to OAS4081. I call that
    from JDeveloper so it good. But when I try
    to call from applet in IExpl5 I can't
    instantiate the ORB. I've got a com.ms.security.SecurityException : oracle.oas.orb.CORBA.ORB.init
    I coded the CLASSPATH(oasoorb(yoj),client,
    ejbapi...) perfectly, I think.
    If anybody could help, please...
    Thanx!

    Hi there,
              I saw someone on this group had a problem to locate proper classpath
              to call EJB from JSP. I thought if you call EJB from classpath, you are
              calling the bean. But you loss all the EJB functions. To be able to utilize
              EJB features like object pooling. You need to call it from Weblogic server
              using url/jndi, not from the jar directly.
              Any comment? Am I right?
              BTW, my question about calling EJB from JSP means calling through URL,
              not a local path.
              Thank you
              >-------------------------------------------------------------------->
              Jim wrote in message <[email protected]>...
              >Hi there,
              > Can I call EJB from JSP? Is there a particular security setting or
              >concern for Weblogic? Is there an coding example?
              >
              >Thank you
              >
              >
              

  • Calling EJB from an applet in 9iAS Release 2?

    Hello!
    In 9iAS Release 1 it is not so easy to call an EJB from an applet. First the applet needs special privileges and then the applet starts only once. The cause of problem is the implementation of ormi.
    Will 9iAS Rel. 2 support Applets calling EJBs?

    Jeff,
    I am also trying to make an applet client for an EJB deployed to OC4J.
    I modified the java2.policy file as you suggested, but when I tried to run my applet, I
    got the following error:
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission tunneling.shortcut read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.lang.Boolean.getBoolean(Unknown Source)
         at com.evermind.server.rmi.RMIInitialContextFactory.<clinit>(RMIInitialContextFactory.java:34)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at its.fnd.ejb.EJBHomeFinder.getHomeObject(Unknown Source)
         at its.fnd.flight.ejb.EJBFlightFactory.<init>(Unknown Source)
         at its.fnd.flight.FlightFactory.<init>(FlightFactory.java:97)
         at EJBApplet.jbInit(EJBApplet.java:47)
         at EJBApplet.init(EJBApplet.java:36)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    I am using OC4J (stand-alone) version 9.0.2.0.0 on Solaris 7 and Microsoft Internet Explorer
    5.0 with the java 1.3.1 plug-in.
    Here is the applet code that I use to lookup the EJB home interface:
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
    props.put(Context.PROVIDER_URL,"ormi://host:6666/app");
    props.put(Context.SECURITY_PRINCIPAL,"admin");
    props.put(Context.SECURITY_CREDENTIALS,"password");
    Context ctxt = new InitialContext(props);
    Object homeObj = ctxt.lookup("my_bean");
    MyBeanHome home = PortableRemoteObject.narrow(homeObj, MyBeanHome.class);
    The HTML page with the <applet> tag is a static HTML page that is part of OC4J's default
    web application. The applet class file is located in a subdirectory of the default-web-app
    directory. Here is the HTML page...
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    HTML Test Page
    </TITLE>
    </HEAD>
    <BODY>
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="580" height="450" name="EJBApplet" align="middle" alt="Loading EJBApplet ...">
    <param name="java_code" value="EJBApplet">
    <param name="java_codebase" value="/tests">
    <param name="java_archive" value="xerces.jar,ejb.jar,oc4j.jar,jaas.jar"/>
    <param name="java_type" value="application/x-java-applet;version=1.3">
    <param name="java_scriptable" value="true">
    <table cellpadding="1" bgcolor="#FFFFFF" width="580" height="450">
    <tr><td>
    This is a place for an APPLET.<br>Your browser doesn't support the correct applet java plug-in.<br><br>You can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="/classes/3rdparty/j2re-win-plug-in.exe">Click here to install plug-in.</a><br><br>Or if you have an Internet connection you can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="http://java.sun.com/products/plugin/1.3/plugin-install.html">Click here to install plug-in from Internet.</a><br><br>You can call your System Administrator for assistance.</td></tr>
    </table>
    </object>
    </BODY>
    </HTML>
    I have searched the Internet, and the documentation, and tried several, different things,
    but I can't get it to work.
    Any and all help will be greatly appreciated.
    Thanks,
    Sofia.

Maybe you are looking for

  • Safari 2.0.4 crashes 100% of the time on a Whitebook

    My friend who is 12,00 miles away reports that her Safari will not launch and after the first time when it actually admitted to quitting unexpectedly, no longer says anything to excuse itself. She's using a Whitebook single core OSX 10.4.10 I've done

  • Safari keeps crashing randomly, I've included a report :(

    At completely random times (and usually after only a couple of minutes, Safari will crash on me). I have to finish this post quickly before it happens again...! Anyway, here is the report: Date/Time: 2009-01-30 14:49:27.912 -0800 OS Version: 10.4.11

  • Issue in creating a add link to a document content type on a doc lib name with , / special characters

    hi, i am having a  requirement to create/use "add link to a document" content type for a item in the document library. so i got  the code from below site : http://howtosharepoint.blogspot.in/2010/05/programmatically-add-link-to-document.html my issue

  • Effective price doubled in PIR

    Hi, Whenevr the condition PB00 is updated with a price, the effective price gets updated with doublt the amount.For ex: if Net price= 100 then Eff price = 200. What could be the possible reasons for this? But it gets updated with the correct amount w

  • Lightroom 4 Download issue

    I am having an issue downloading Lightroom 4 onto my MacBook Pro. Please help!