Weblogic EJB 3 proxy & EJB 3 session bean interface

Does the weblogic EJB 3 session bean proxies implement the bean interface ?
I tried accessing the session bean from within a EJB 3 interceptor - InvocationContext.getTarget()
But it looks like this returns a proxy (created by weblogic internally) that does not implement the bean interface.
I'm unable to integrate Hibernate method validator as a result since the validator API expects the target to either be the actual bean implementation or at least a proxy
that implements the bean interfaces. Can somebody please confirm ?
I'm on weblogic 10.3
thanks!

You should be able to see the code we generate by running the weblogic.appc utility on your application, specifying the "-keepgenerated" option to keep the Java source files.
-steve-

Similar Messages

  • Minimal requirements for remote client app to call a EJB 3 session bean

    I'm just starting to get into EJBs, trying to learn the EJB 3 APIs. I kind of understand the setup on the server side to create a session bean. What I don't understand is what I would have to deploy for each of the remote client app (Swing-based GUI or something like that) installations. Of course, the client app code would have to be deployed to each client desktop, but what stuff related to the session bean? Just the session bean interface class?
    For ease of discussion, let's say my bean is CalculatorBean, having two interfaces, CalculatorRemoteIface and CalculatorLocalIface. Let's also say my client app, CalculatorUI, is a simple Swing-based GUI that grabs a reference to a CalculatorBean.
    Other than just the Swing-based classes and the JRE, what JARs/classes will I want to deploy to each desktop?
    (Please assume the latest Sun Java System App Server 9 and Java EE 5, if you are familiar with them.)

    Personally- I would deploy your backend
    in EJB 3.0, but then expose it as a web service. It
    is MUCH easier for your clients to connect to a web
    service (and mantain that code), then to have them
    connect via RMI/JNDI.Oh, I would say it's quite the opposite. RMI/JNDI is MUCH easier from a client point of view than web services. To make web services work easy from the client side you have to generate code and the tools that generate code from a web services wsdl file doesn't do a great job today. But that was not the question. But take some time reading this article about webservices...it's quite funny and spot on: http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple
    Now to your question, yes you will need the remote interface on the client side.
    /klejs

  • Using local session bean interface from web container using EJB 3.0

    Hi,
    How can you use a local session bean interface from Java (rather than data controls) in a web container using EJB 3.0?
    I can use a remote interface by looking up InitialContext, but I can't find a local interface this way (even from another session EJB). I can use a local interface from an EJB using annotation "EJB", but as I understand, this is not available in the web container.
    If I try to add an ejb-jar.xml file, these seems to mess up by project...
    Hope you can help.
    Roger

    The portable way to retrieve an EJB reference in Java EE is to either inject it or look it up via the
    component's private naming environment. The simplest way is :
    @EJB
    private DocumentManager dm;
    The global JNDI name is only used as an implementation specific way to uniquely assign an
    identifier to a specific Remote EJB. It's best for this not to appear directly in the source code.
    There's more on global JNDI names in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    The alternative to annotations is to use an ejb-ref to declare the ejb dependency. The ejb-ref
    is declared in the standard deployment descriptor corresponding to the component doing the
    lookup. Each ejb-ref has an ejb-ref-name, e.g. <ejb-ref-name>DM_ref</ejb-ref-name>
    The code looks up the ejb-ref-name relative to the java:comp/env namespace to retrieve the
    EJB reference.
    DocumentManager dm = (DocumentManager)
    new InitialContext().lookup("java:comp/env/DM_ref");

  • Weblogic.ejb.extensions.LockTimedOutException: Bean could not be locked, current owner: '1068220908390_17680', new owner: '1068220908390_17748', timeout: '300000' ms

    Hi All,
    Again, Since yesterday (11/11/2003) , I started getting the Bean Lock error as
    below (I am using weblogic 4.5.1) :
    Note: We are using Stateless beans.
    Tue Nov 11 14:15:11 CET 2003:<I> <EJB> Transaction: '1068220908390_17748' rolled
    back due to EJB exception:
    com.sgs.common.framework.exception.EPlatformSystemException: An unexpected error
    occurs when trying to perform your request (RemoteException).
    weblogic.ejb.extensions.LockTimedOutException: Bean could not be locked, current
    owner: '1068220908390_17680', new owner: '1068220908390_17748', timeout: '300000'
    ms
         at com.sgs.ecertificate.CertificateSessionBean.getCertificate(CertificateSessionBean.java:1866)
         at com.sgs.ecertificate.CertificateSessionBean.approveCertificate(CertificateSessionBean.java:2617)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl.approveCertificate(CertificateSessionBeanEOImpl.java:936)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl_ServiceStub.approveCertificate(CertificateSessionBeanEOImpl_ServiceStub.java:1761)
         at com.sgs.ecertificate.ProcessApproveCertificateServlet.processRequest(ProcessApproveCertificateServlet.java:219)
         at com.sgs.common.framework.servlet.EPlatformServlet.doPost(EPlatformServlet.java:189)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:311)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:257)
         at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:550)
         at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:284)
         at weblogic.t3.srvr.ExecuteThread.run(ExecuteThread.java:105)
    Tue Nov 11 14:15:11 CET 2003: ERR #-3# com.sgs.ecertificate.ProcessApproveCertificateServlet
    An unexpected error occurs when trying to perform your request (RemoteException).
    com.sgs.common.framework.exception.EPlatformSystemException: An unexpected error
    occurs when trying to perform your request (RemoteException).
    weblogic.ejb.extensions.LockTimedOutException: Bean could not be locked, current
    owner: '1068220908390_17680', new owner: '1068220908390_17748', timeout: '300000'
    ms
         at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java:310)
         at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java:128)
         at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:182)
         at com.sgs.ecertificate.entity.CertificateEntityBeanEOImpl.getData(CertificateEntityBeanEOImpl.java:4645)
         at com.sgs.ecertificate.CertificateSessionBean.getCertificate(CertificateSessionBean.java:1743)
         at com.sgs.ecertificate.CertificateSessionBean.approveCertificate(CertificateSessionBean.java:2617)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl.approveCertificate(CertificateSessionBeanEOImpl.java:936)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl_ServiceStub.approveCertificate(CertificateSessionBeanEOImpl_ServiceStub.java:1761)
         at com.sgs.ecertificate.ProcessApproveCertificateServlet.processRequest(ProcessApproveCertificateServlet.java:219)
         at com.sgs.common.framework.servlet.EPlatformServlet.doPost(EPlatformServlet.java:189)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:311)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:257)
         at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:550)
         at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:284)
         at weblogic.t3.srvr.ExecuteThread.run(ExecuteThread.java:105)
    Thanks a lot in advance.
    Regards,
    Nilesh.

    Hi All,
    Again, Since yesterday (11/11/2003) , I started getting the Bean Lock error as
    below (I am using weblogic 4.5.1) :
    Note: We are using Stateless beans.
    Tue Nov 11 14:15:11 CET 2003:<I> <EJB> Transaction: '1068220908390_17748' rolled
    back due to EJB exception:
    com.sgs.common.framework.exception.EPlatformSystemException: An unexpected error
    occurs when trying to perform your request (RemoteException).
    weblogic.ejb.extensions.LockTimedOutException: Bean could not be locked, current
    owner: '1068220908390_17680', new owner: '1068220908390_17748', timeout: '300000'
    ms
         at com.sgs.ecertificate.CertificateSessionBean.getCertificate(CertificateSessionBean.java:1866)
         at com.sgs.ecertificate.CertificateSessionBean.approveCertificate(CertificateSessionBean.java:2617)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl.approveCertificate(CertificateSessionBeanEOImpl.java:936)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl_ServiceStub.approveCertificate(CertificateSessionBeanEOImpl_ServiceStub.java:1761)
         at com.sgs.ecertificate.ProcessApproveCertificateServlet.processRequest(ProcessApproveCertificateServlet.java:219)
         at com.sgs.common.framework.servlet.EPlatformServlet.doPost(EPlatformServlet.java:189)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:311)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:257)
         at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:550)
         at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:284)
         at weblogic.t3.srvr.ExecuteThread.run(ExecuteThread.java:105)
    Tue Nov 11 14:15:11 CET 2003: ERR #-3# com.sgs.ecertificate.ProcessApproveCertificateServlet
    An unexpected error occurs when trying to perform your request (RemoteException).
    com.sgs.common.framework.exception.EPlatformSystemException: An unexpected error
    occurs when trying to perform your request (RemoteException).
    weblogic.ejb.extensions.LockTimedOutException: Bean could not be locked, current
    owner: '1068220908390_17680', new owner: '1068220908390_17748', timeout: '300000'
    ms
         at weblogic.ejb.internal.StatefulEJBCache.bind(StatefulEJBCache.java:310)
         at weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java:128)
         at weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:182)
         at com.sgs.ecertificate.entity.CertificateEntityBeanEOImpl.getData(CertificateEntityBeanEOImpl.java:4645)
         at com.sgs.ecertificate.CertificateSessionBean.getCertificate(CertificateSessionBean.java:1743)
         at com.sgs.ecertificate.CertificateSessionBean.approveCertificate(CertificateSessionBean.java:2617)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl.approveCertificate(CertificateSessionBeanEOImpl.java:936)
         at com.sgs.ecertificate.CertificateSessionBeanEOImpl_ServiceStub.approveCertificate(CertificateSessionBeanEOImpl_ServiceStub.java:1761)
         at com.sgs.ecertificate.ProcessApproveCertificateServlet.processRequest(ProcessApproveCertificateServlet.java:219)
         at com.sgs.common.framework.servlet.EPlatformServlet.doPost(EPlatformServlet.java:189)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:311)
         at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:257)
         at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:550)
         at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:284)
         at weblogic.t3.srvr.ExecuteThread.run(ExecuteThread.java:105)
    Thanks a lot in advance.
    Regards,
    Nilesh.

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

  • Deploying EJB 3 session beans on OC4J 10.1.3.0.0 Standalone

    Guys,
    I am unable to deploy any EJB 3.0 session beans on my freshly installed OC4J 10.1.3.0.0 instance. I also have tried to deploy the EAR created by the "Develop a Stateless Session Bean using EJB 3.0" to eliminate problems in the deployed archive, but itfails with the exact same stacktrace:
    06/06/05 14:38:52 SEVERE: ProgressObjectImpl.reportError java.lang.InstantiationException: Error initializing ejb-module
    s: nested exception is: java.lang.reflect.InvocationTargetExceptionoracle.oc4j.admin.jmx.shared.exceptions.InternalExcep
    tion: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.reflect.Invocatio
    nTargetException
    at oracle.oc4j.admin.jmx.shared.deploy.NotificationUserData.<init>(NotificationUserData.java:107)
    at oracle.oc4j.admin.internal.Notifier.reportError(Notifier.java:429)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:123)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:819)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Error initializing ejb-module
    s: nested exception is: java.lang.reflect.InvocationTargetException
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
    ... 4 more
    Caused by: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.reflect.Invo
    cationTargetException
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1056)
    at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:210)
    at com.evermind.server.Application.setConfig(Application.java:391)
    at com.evermind.server.Application.setConfig(Application.java:308)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1771)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:507)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:191)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    ... 4 more
    Caused by: javax.ejb.EJBException: nested exception is: java.lang.reflect.InvocationTargetException
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:352)
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:343)
    at com.evermind.server.ejb.POJOEntityAnnotationListener.parseAnnotatedClass(POJOEntityAnnotationListener.java:56
    at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:197)
    at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:69)
    at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:964)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:831)
    ... 11 more
    Caused by: java.lang.reflect.InvocationTargetException
    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:585)
    at com.evermind.server.ejb.POJOEntityAnnotationListener.parseAnnotatedClass(POJOEntityAnnotationListener.java:48
    ... 15 more
    Caused by: java.lang.NullPointerException
    at java.lang.Class.getAnnotation(Class.java:2956)
    ... 20 more
    Also, and this is probably related, when starting up it the app server prints:
    6-06-05 14:38:51.777 WARNING J2EE EJB5003 EJB 3.0 enabled but JDK 1.5 is not in use. No annotations will be parsed.
    Which is not true as I am running JDK 5.0_6 and I have tested/validated this by deploying a working (working as in putting stuff in and pulling stuff out of a db) EJB 3.0 Persistence project in there, which uses annotations.
    I really hope somebody on the OC4J team can help me out on this, as I am guessing a lot of people will run into this.
    Kind regards,
    Mik

    Well, I think I at least isolated the problem:
    My installation was not as fresh as I thought. It had to do with my trying to get the latest version of TopLink (the final EJB 3.0 RI one) running on the latest OC4J standalone. For this I deleted the j2ee/home/persistence.jar and replaced it by toplink-essentials.jar. I apparently misjudged the differences that occured in the last steps of the EJB 3 specs.
    So let me rephrase my question: is there a way to get the latest version of TopLink (the one packaged as the EJB3 Persistence RI) in the OC4J 10.1.3.0 Standalone container? And if not, when will there be one?
    Mik

  • Help needed in EJB - to call AS from EJB a Session Bean

    Hi All ,
    I have been strictly told not to use Web Services as all the applications are on the same server
    actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Service).
    the CAF layer has 5 parts metadata , permissions , dictionary , ear and ejbmodule.
    I added the ejbModule to the Build Path of the calling EJB Session Bean. And so I was able to access the operations of the Application Service which in turn accesses a BAPI(The Appl Service operation returns a String).
    But while executing I got the exception java.lang.RuntimeException: java.lang.NoClassDefFoundError
    My method :
    Normally from a Dynamic Web Project acting as a client to an EJB Session bean, I was able to get access to EJB Local Interface by using
      private ConverterLocal converterBean = null;
      public void jspInit() {
        try {
         InitialContext ic = new InitialContext();
         converterBean = (ConverterLocal)
         ic.lookup("java:comp/env/Converter");
        } catch (Exception ex) {
             System.out.println("Couldn't create converter bean."+
           ex.getMessage());
    BigDecimal dollarAmount =  converterBean.euroToDollar(value);
    So I created a JNDI field in ejb-j2ee-engine.xml
    enterprise-beans>
            <enterprise-bean>
         <ejb-name>com.sap*******.bapi_company_getlist.BAPI_COMPANY_GETLIST</ejb-name>
                   <jndi-name>COMPANY</jndi-name>
                </enterprise-bean>
    </enterprise-beans>
    And from my Session Bean , I tried to access it using the code in already existing Bean which was working fine
    BAPI_COMPANY_GETLISTBeanImpl bean = new BAPI_COMPANY_GETLISTBeanImpl();
              try {
                   InitialContext ctx = new InitialContext();
                   bean = (BAPI_COMPANY_GETLISTBeanImpl)ctx.lookup("COMPANY");
              } catch (NamingException e) {
                   System.out.println("Converter Bean can't be created");
                   String send = bean.returnDetails();
    And I tried to print the String , but I got the above error
    I have a doubt :
    1) How do I specify the JNDI name ie in the ejb-j2ee-engine.xml file , what should I add as the name of the ejb
    is this sufficient , or are there more steps ??

    Hi Ekaterina,
    I have the document to access my Bean from another Bean.
    I could access my Bean from a standalone Java class with this code
    Properties props = new Properties();
              props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
              props.put(Context.PROVIDER_URL,"hostname:port");
              try{
                   Context ctx = new InitialContext(props);
                   Object o = ctx.lookup("sap.com/TestEAR/REMOTE/TestBean/com.@#$.TestRemote");
                   TestRemote testRem = (TestRemote)javax.rmi.PortableRemoteObject.narrow(o, TestRemote.class);
                   String msg = testRem.getMessage();
                   System.out.println(msg);
    And in this document there is a way shown to access a bean from another Bean.
       http://help.sap.com/saphelp_nw04/helpdata/en/13/c8633e0084e946e10000000a114084/frameset.htm
    If your client is another enterprise bean, declare the EJB reference in the ejb-jar.xml.
    -For more information, see Declaring EJB References.
    But the problem is that in EJB 3.0 ,  I can't see the ejb-jar.xml file .
    So how should I have a Bean as a client to another Bean, I am not that familiar with Annotations.

  • 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

  • Using EJB remote session beans llike webservice.

    My requirement is to fetch a big size ASCII stream file from a remote location. For this can I use Statless EJB Session beans?
    For this EJB application & Web application will be on my application server side & EJB client should reside on the remote end side from where I want to fetch the file. - Please confirm my this logic as I am new in Java & EJB, I am having a basic query like this. (I don't want to proceed with EJB web service like (@Stateless, @WebService), I want to purly use EJB Statless Remote session beans - Is this possible?
    If yes, can I have one sample example URL pls?
    Thanks in advance for your help.

    My requirement is to fetch a big size ASCII stream file from a remote location. For this can I use Statless EJB Session beans?
    For this EJB application & Web application will be on my application server side & EJB client should reside on the remote end side from where I want to fetch the file. - Please confirm my this logic as I am new in Java & EJB, I am having a basic query like this. (I don't want to proceed with EJB web service like (@Stateless, @WebService), I want to purly use EJB Statless Remote session beans - Is this possible?
    If yes, can I have one sample example URL pls?
    Thanks in advance for your help.

  • Authenticating EJB 3 Session Bean Web services

    I have some session beans that I want to expose directly as web services in Glassfish.
    My question is how do I protect them to only be used by authorized people?
    Do I simply use standard role based JEE authentication like normal session beans?
    Is there a client example that talks to an authenticated session bean?
    If this isn't the way it is done, can someone provide an example on how it should be done?
    Thanx!

    The portable way to retrieve an EJB reference in Java EE is to either inject it or look it up via the
    component's private naming environment. The simplest way is :
    @EJB
    private DocumentManager dm;
    The global JNDI name is only used as an implementation specific way to uniquely assign an
    identifier to a specific Remote EJB. It's best for this not to appear directly in the source code.
    There's more on global JNDI names in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    The alternative to annotations is to use an ejb-ref to declare the ejb dependency. The ejb-ref
    is declared in the standard deployment descriptor corresponding to the component doing the
    lookup. Each ejb-ref has an ejb-ref-name, e.g. <ejb-ref-name>DM_ref</ejb-ref-name>
    The code looks up the ejb-ref-name relative to the java:comp/env namespace to retrieve the
    EJB reference.
    DocumentManager dm = (DocumentManager)
    new InitialContext().lookup("java:comp/env/DM_ref");

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

  • EJB: Stateless Session Bean create() Question.

    Lets say I have a stateless session bean that fetches data from my database. The point of the bean is to just do large SQL searches and funnel data back to the client. The prolem I have is that I am somehow fighting memory leaks. Despite having checked the code a number of times, the memory usage on my appserver continues to climb no matter what I do. I have theorized that the problem might be in the way Im using ma DataFetchBean (DFB).
    When I start the client, he obtains a user session. This is a stateful session bean that he uses for almost all communication with the server. Then I call "getDataFetchBean" in the user session which calls DataFetchBeanHome.create(). Then the client holds onto the returned reference, using it for the live of his connection. As he disconnects, he calls remove on the bean.
    Question is this:
    1) Is it better for me to call create() prior to each call to the stateless session bean ?
    2) Do you have any theories on why im loosing memory with this setup?
    TIA
    -- Rob

    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

  • EJB Stateless Session Bean Transactions

    I have a stateless session bean.
    Its deployment descripter references a JDBC DataSource.
    It uses container managed transactions.
    If I make JDBC calls, within a business method
    of this stateless session bean, with the referred datasource, is it attached
    to a container managed transaction?

    If I make JDBC calls, within a business method
    of this stateless session bean, with the referred
    datasource, is it attached
    to a container managed transaction?IIRC, yes. For CMT, the container will roll back any JDBC actions carried out by a method if it fails.

  • [EJB] Stateful session bean--- strange error

    hi guys,
    here s my problem. i m trying to developp a stateful session bean with two ejbcreate method. one with parameters ( ejbcreate(int val)) and another one without (ejbcreate()).
    The client can call ejbcreate without any pbs. everything s allright.
    but when i try to get a remote access to the bean via a
    MY_BEAN.create(5); then i got an error saying :
    FAILED TO FIND METHOD FOR HASH ......
    i dont understand cuz i checked my files many times and the two methods are implemented and declared in the home interface.
    what should i do ?
    please.
    tery

    Hi Tery,
    You are in the wrong forum. This forum is for the Sun Java Studio Creator.
    Cheers :-)!!!

  • My weblogic 7 can not run stateful session bean??

    Hi,all
    I create a stateful session bean in jbuilder 7 and deploy it to weblogic 7,it
    successed.The Home interface have a method like this:
    public TestRemote create(int var) throws RemoteException, CreateException;
    But the client test bean call the create(int var) method throwing
    a exception :
    java.lang.IllegalArgumentException: wrong number of arguments
    Start server side stack trace:
    java.lang.IllegalArgumentException: wrong number of arguments
         at java.lang.reflect.Constructor.newInstance(Native Method)
         at weblogic.rmi.internal.OIDManager.makeActivatableServerReference(OIDManager.java:203)
         at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:129)
         at weblogic.common.internal.RemoteObjectReplacer.getReplacement(RemoteObjectReplacer.java:265)
         at weblogic.common.internal.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:107)
         at weblogic.common.internal.ChunkedObjectOutputStream.replaceObject(ChunkedObjectOutputStream.java:53)
         at weblogic.common.internal.ChunkedObjectOutputStream$NestedObjectOutputStream.replaceObject(ChunkedObjectOutputStream.java:239)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:323)
         at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:107)
         at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:82)
         at com.berserk.ejb.Test_a6z4o8_HomeImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
         at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:762)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:295)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    End server side stack trace
    -- Failed: create(0)
         at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
         at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:127)
         at com.berserk.ejb.Test_a6z4o8_HomeImpl_WLStub.create(Unknown Source)
         at com.berserk.ejb.TestClient1.create(TestClient1.java:102)
         at com.berserk.ejb.TestClient1.main(TestClient1.java:199)
    -- Return value from create(0): null.
    Then I deploy it to the borland application server 4.5,it did work!!
    Somebody can help me ?thx

    Try throwing a CreateException in ejbCreate (int var).
    Jackie wrote:
    hi,Sabha:
    My source codes is like this.
    the home interface:
    import java.rmi.*;
    import javax.ejb.*;
    public interface TestHome extends EJBHome
    public TestRemote create(int var) throws RemoteException, CreateException;
    the remote interface :
    import java.rmi.*;
    import javax.ejb.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public interface TestRemote extends EJBObject
    public void saycool() throws java.rmi.RemoteException;
    the stateful bean:
    import java.rmi.*;
    import javax.ejb.*;
    public class Test implements SessionBean
    private SessionContext sessionContext;
    private int m_var;
    public void ejbCreate(int var)
    this.m_var=var;
    public void ejbRemove()
    public void ejbActivate()
    public void ejbPassivate()
    public void setSessionContext(SessionContext sessionContext)
    this.sessionContext = sessionContext;
    public void saycool() throws java.rmi.RemoteException
    System.out.println("so cool");
    the client test class:
    import javax.naming.*;
    import java.util.Properties;
    import javax.rmi.PortableRemoteObject;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class TestClient1
    static final private String ERROR_NULL_REMOTE = "Remote interface reference
    is null. It must be created by calling one of the Home interface methods first.";
    static final private int MAX_OUTPUT_LINE_LENGTH = 100;
    private boolean logging = true;
    private TestHome testHome = null;
    private TestRemote testRemote = null;
    //Construct the EJB test client
    public TestClient1()
    long startTime = 0;
    if (logging)
    log("Initializing bean access.");
    startTime = System.currentTimeMillis();
    try
    //get naming context
    Context ctx = getInitialContext();
    //look up jndi name
    Object ref = ctx.lookup("TestRemote");
    //cast to Home interface
    testHome = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
    if (logging)
    long endTime = System.currentTimeMillis();
    log("Succeeded initializing bean access.");
    log("Execution time: " + (endTime - startTime) + " ms.");
    catch(Exception e)
    if (logging)
    log("Failed initializing bean access.");
    e.printStackTrace();
    private Context getInitialContext() throws Exception
    String url = "t3://lettam:7001";
    String user = null;
    String password = null;
    Properties properties = null;
    try
    properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    properties.put(Context.PROVIDER_URL, url);
    if (user != null)
    properties.put(Context.SECURITY_PRINCIPAL, user);
    properties.put(Context.SECURITY_CREDENTIALS, password == null
    ? "" : password);
    return new InitialContext(properties);
    catch(Exception e)
    log("Unable to connect to WebLogic server at " + url);
    log("Please make sure that the server is running.");
    throw e;
    // Methods that use Home interface methods to generate a Remote interface
    reference
    public TestRemote create(int var)
    long startTime = 0;
    if (logging)
    log("Calling create(" + var + ")");
    startTime = System.currentTimeMillis();
    try
    testRemote = testHome.create(var);
    if (logging)
    long endTime = System.currentTimeMillis();
    log("Succeeded: create(" + var + ")");
    log("Execution time: " + (endTime - startTime) + " ms.");
    catch(Exception e)
    if (logging)
    log("Failed: create(" + var + ")");
    e.printStackTrace();
    if (logging)
    log("Return value from create(" + var + "): " + testRemote + ".");
    return testRemote;
    // Methods that use Remote interface methods to access data through the bean
    public void saycool()
    if (testRemote == null)
    System.out.println("Error in saycool(): " + ERROR_NULL_REMOTE);
    return ;
    long startTime = 0;
    if (logging)
    log("Calling saycool()");
    startTime = System.currentTimeMillis();
    try
    testRemote.saycool();
    if (logging)
    long endTime = System.currentTimeMillis();
    log("Succeeded: saycool()");
    log("Execution time: " + (endTime - startTime) + " ms.");
    catch(Exception e)
    if (logging)
    log("Failed: saycool()");
    e.printStackTrace();
    public void testRemoteCallsWithDefaultArguments()
    if (testRemote == null)
    System.out.println("Error in testRemoteCallsWithDefaultArguments():
    " + ERROR_NULL_REMOTE);
    return ;
    saycool();
    // Utility Methods
    private void log(String message)
    if (message == null)
    System.out.println("-- null");
    return ;
    if (message.length() > MAX_OUTPUT_LINE_LENGTH)
    System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH)
    + " ...");
    else
    System.out.println("-- " + message);
    //Main method
    public static void main(String[] args)
    TestClient1 client = new TestClient1();
    client.create(0);
    // Use the client object to call one of the Home interface wrappers
    // above, to create a Remote interface reference to the bean.
    // If the return value is of the Remote interface type, you can use it
    // to access the remote interface methods. You can also just use the
    // client object to call the Remote interface wrappers.
    Thank you for your help!!
    "Sabha" <[email protected]> wrote:
    Can you attach the sources of your ejb. Thanks.
    -Sabha
    "Jackie Lee" <[email protected]> wrote in message
    news:[email protected]...
    Hi,all
    I create a stateful session bean in jbuilder 7 and deploy it to weblogic7,it
    successed.The Home interface have a method like this:
    public TestRemote create(int var) throws RemoteException,CreateException;
    But the client test bean call the create(int var) method throwing
    a exception :
    java.lang.IllegalArgumentException: wrong number of arguments
    Start server side stack trace:
    java.lang.IllegalArgumentException: wrong number of arguments
    at java.lang.reflect.Constructor.newInstance(Native Method)
    atweblogic.rmi.internal.OIDManager.makeActivatableServerReference(OIDManager.j
    ava:203)
    at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:129)
    atweblogic.common.internal.RemoteObjectReplacer.getReplacement(RemoteObjectRep
    lacer.java:265)
    atweblogic.common.internal.RemoteObjectReplacer.replaceObject(RemoteObjectRepl
    acer.java:107)
    atweblogic.common.internal.ChunkedObjectOutputStream.replaceObject(ChunkedObje
    ctOutputStream.java:53)
    atweblogic.common.internal.ChunkedObjectOutputStream$NestedObjectOutputStream.
    replaceObject(ChunkedObjectOutputStream.java:239)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:323)
    atweblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObject
    OutputStream.java:107)
    atweblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:8
    2)
    at com.berserk.ejb.Test_a6z4o8_HomeImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
    atweblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:762)
    atweblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:295)
    atweblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    End server side stack trace
    -- Failed: create(0)
    atweblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.
    java:109)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:127)
    at com.berserk.ejb.Test_a6z4o8_HomeImpl_WLStub.create(Unknown Source)
    at com.berserk.ejb.TestClient1.create(TestClient1.java:102)
    at com.berserk.ejb.TestClient1.main(TestClient1.java:199)
    -- Return value from create(0): null.
    Then I deploy it to the borland application server 4.5,it did work!!
    Somebody can help me ?thx
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

Maybe you are looking for

  • Cycle rows in KSU5: can add more row?Is it sequential?

    Hi guyz, Regarding cycle rows in KSU5: 1. Can I add more cycle rows in KSU5?     If I need more than 13 rows that is provided, where I can do it and how? 2. Is SAP read and execute the cycle rows by sequential?     Ex.: If I put cycle B001 at row 1,

  • How to increase the field lenght of file uplaod in BSP application

    Hi All,    I am facing a problem with u201Cuploadu201D filed length in BSP application. When we upload the file in BSP page, the path displayed should be the full path (i.e. from where the file is being upload the file) Now this field is appearing 20

  • Check Process memory consumption and Kill it

    Hello I have just installed Orchestrator and have a problem that I think is perfekt for Orchestrator to handle. I have a process that sometimes hangs and the only way to spot it is that the memory consumption has stoped. The process is started every

  • Internet problem at HP slate 10 tablet

    Hi I have HP slate 10 Tablet and using idea 3g sim for internet but there is no option for 3g in tablet only 2g option is there then kindly tell me that how to activate 3g 

  • Standalone Weblogic deployment not working for ADF Table

    Hi All, I have create one application using JDeveloper 11g R3. I have taken one ADF Rich Table When i run application in Jdeveloper it runs fine. Now issue is when i deployee the same in standalone Weblogic server it is not running(Page gets open but