Stateless session EJBs  & "idempotent"

We need to declare a method as "idempotent" to take care of failure inside a
          method call, For that to work the code inside should written in such way so
          that repeated call to the same method should not give us diffrent result.
          But why can't weblogic implement a partial rollback( Just like Oracle's save
          point rollback, where you can rollback to certain point within a
          transaction).
          Because some times it is not possible to code in such a way to get the same
          result every time(Incase of fail over)
          Thanks
          ,Stateless session EJBs
          Stateless session EJBs can have both a cluster-aware home stub and a
          replica-aware EJBObject stub. By default, WebLogic Server provides failover
          services for EJB method calls, but only if a failure occurs between method
          calls. For example, failover is automatically supported if there is a
          failure after a method completes, or if the method fails to connect to a
          server. When failures occur while an EJB method is in progress, WebLogic
          Server does not automatically failover from one server to another.
          This default behavior ensures that database updates within an EJB method are
          not "duplicated" due to a failover scenario. For example, if a client calls
          a method which increments a value in a datastore and WebLogic Server fails
          over to another server before the method completes, the datastore would be
          updated twice for the client's single method call.
          If methods are written in such a way that repeated calls to the same method
          do not cause duplicate updates, the method is said to be "idempotent." For
          idempotent methods, WebLogic Server provides the
          stateless-bean-methods-are-idempotent deployment property. If you set this
          property to "true" in weblogic-ejb-jar.xml, WebLogic Server assumes that the
          method is idempotent and will provide failover services for the EJB method,
          even if a failure occurs during a method call.
          

Vishal,
I wouldn't think you would have a problem doing RMI communication from a Entity
Bean - - for instance, when a WLS instance 'hosts' an EJB that communicates to
a different WLS instance that 'hosts' an EJB that communication occurs via RMI.
Chuck Nelson
Developer Relations Engineer
BEA Technical Support

Similar Messages

  • Error during deployment of stateless session EJB using EJB 3.0

    having trouble deploying a stateless session bean to app server 10.1.3.1 oc4j container.
    deceided to go through oracles demo: How-To Develop a Stateless Session EJB using EJB 3.0 (http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-ejb30-stateless-ejb/doc/how-to-ejb30-stateless-ejb.html).
    the demo encounters the same issue. so i assume there is something wrong with the app server set up, and not my source code.
    here is the deployment log:
    [Jul 1, 2009 11:59:25 AM] Application Deployer for test_ws STARTS.
    [Jul 1, 2009 11:59:25 AM] Copy the archive to C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear
    [Jul 1, 2009 11:59:25 AM] Initialize C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear begins...
    [Jul 1, 2009 11:59:25 AM] Unpacking test_ws.ear
    [Jul 1, 2009 11:59:25 AM] Done unpacking test_ws.ear
    [Jul 1, 2009 11:59:25 AM] Initialize C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear ends...
    [Jul 1, 2009 11:59:25 AM] Starting application : test_ws
    [Jul 1, 2009 11:59:25 AM] Initializing ClassLoader(s)
    [Jul 1, 2009 11:59:25 AM] Initializing EJB container
    [Jul 1, 2009 11:59:25 AM] Loading connector(s)
    [Jul 1, 2009 11:59:26 AM] Starting up resource adapters
    [Jul 1, 2009 11:59:26 AM] Processing EJB module: ejb30ws-ejb.jar
    [Jul 1, 2009 11:59:26 AM] application : test_ws is in failed state
    [Jul 1, 2009 11:59:26 AM] Operation failed with error: java.lang.NoClassDefFoundError
    the opmn log reveals the same error, but no more detail.
    any ideas???
    /stuck

    I am having exactly the same issue. Was this issue resolved? If so, please share the resolution and if not can someone please suggest what could be wrong.
    Thanks

  • Transaction rollback in stateless session EJB 3.0

    Hello everyone !
    I have a stateless session EJB as per 3.0 spec.
    /*Remote Interface*/
    package com.nseit.ncfm2.data.ejb;
    import java.sql.SQLException;
    import java.util.Collection;
    import javax.ejb.Remote;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    import javax.naming.NamingException;
    import com.nseit.ncfm2.security.Audit;
    @Remote
    public interface ProductionDataChangesRequestsRemote {
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public boolean shiftCandidateDetails(String sourceNcfmId,
                   String destinationNcfmId, Collection<String> specialCasesList, String shiftingRemarks, String user, Audit updtAudit) throws NamingException, SQLException;
    /*Bean Class*/
    package com.nseit.ncfm2.data.ejb;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    import javax.ejb.TransactionManagement;
    import javax.ejb.TransactionManagementType;
    import javax.naming.NamingException;
    import com.nseit.ncfm2.security.Audit;
    import com.nseit.ncfm2.util.server.lookup.LookUpServerResources;
    import java.sql.*;
    import java.util.*;
    * Session Bean implementation class ProductionDataChangesRequestsBean
    @Stateless(name = "ProductionDataChangesRequestsBean", mappedName = "ProductionDataChangesRequestsEJB")
    @Remote(ProductionDataChangesRequestsRemote.class)
    @TransactionManagement(TransactionManagementType.CONTAINER)
    public class ProductionDataChangesRequestsBean implements
              ProductionDataChangesRequestsRemote {
         * Default constructor.
         public ProductionDataChangesRequestsBean() {
              // TODO Auto-generated constructor stub
         @Override
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public boolean shiftCandidateDetails(String sourceNcfmId,
                   String destinationNcfmId, Collection<String> specialCasesList,
                   String shiftingRemarks, String user, Audit updtAudit)
                   throws NamingException, SQLException {
              // TODO Auto-generated method stub
              Connection conn = null;
              PreparedStatement pstmt = null;
              int updtCnt = 0;
              boolean areDetailsShifted = false;
              try {
                   /* Start: update table-1 */
                   updtCnt = pstmt.executeUpdate();
                   /* End: update table-1 */
                   /* Start: update table-2 */
                   updtCnt = pstmt.executeUpdate();
                   /* End: update table-2 */
                   areDetailsShifted = true;
              } /*catch (SQLException e) {
                   // TODO Auto-generated catch block
                   System.out
                             .println("SQLException in ProductionDataChangesRequestsBean.shiftCandidateDetails(...) "
                                       + e.getMessage());
                   // e.printStackTrace();
                   context.setRollbackOnly();
              } */finally {
                   LookUpServerResources.closeStatement(pstmt);
                   LookUpServerResources.closeConnection(conn);
              return areDetailsShifted;
    Currently,if the 1st table update succeeds and the 2nd table update gives an exception,a rollback is not taking place i.e records in 1st table are updated.
    I want the transaction to be rolled back in case an SQLException occurs(or for that matter,any runtime exception occurs).
    I tried two approaches :
    i: Use of context.setRollbackOnly() in catch block for SQLException
    ii:Throwing the SQLException
    In both the cases, the transaction didn't roll back.
    How can I achieve this :
    i: Without the usage of @ApplicationException annotation(as I do not have any application exceptions)
    ii: Without catching the SQLException and then calling context.setRollbackOnly()
    Or what is the standard way?
    Thanks !

    Where is your connection object coming from?

  • Stateless Session EJB hangs using URLConnection but WLS doesn't clean up

    Hi
    We have a stateless session EJB running under WLS 5.1 with service
    pack 10 on Solaris.
    The bean calls a remote HTTP server using the java.net.URLConnection
    class and forwards the response to the EJB client. The bean is largely
    working fine but some threads hang waiting on the HTTP response. Debug
    statements, which are written immediately after the response has been
    read and the connection has been closed, do not appear in our log for
    the hung threads. The WebLogic Console displays these threads as "in
    use" and a "netstat -an" displays the tcp connections as ESTABLISHED.
    However, the access logs of the remote Apache server show the HTTP
    connections of the threads in question completed successfully with
    HTTP code 200. The Apache server is using keep-alive connections.
    Some EJB threads are still waiting for something it seems.
    Has anyody else experienced this when using URLConnection from
    stateless session EJBs under WLS?
    The second problem is why doesn't WLS time these threads out after
    trans-timeout-seconds (we're using the default of 300 seconds)? The
    WLS log shows no error messages relating to this problem.
    I'm grateful for any info offered.
    Thanks in advance
    Steve

    If you suspect that WLS protocol handler is at fault (and quite often it is),
    one thing to try is (if you use Sun's JVM) to use Sun's HTTP protocol handler
    instead of WLS (the most common symptom is when code which makes HTTP requests
    works fine outside of WebLogic and you have problems getting it to work inside
    WebLogic) :
    replace
    URL url = new URL("http://...");
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    with
    URL url = new URL(null, "http://...", new sun.net.www.protocol.http.Handler());
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    You will have to edit weblogic.policy to allow your code to specify protocol
    handler.
    Also note that transaction timeout is only checked on method boundaries, or
    when your code attempts to do something with the database - it is not going to
    interrupt thread which is waiting for HTTP response.
    Steve Lock <[email protected]> wrote:
    Hi
    Thanks for the info. The remote HTTP server's access log shows that
    the requests were successfully processed. Doesn't this mean that the
    connection is then closed? I know the web server is using keep-alive
    connections but I thought this was transparent to the client...?
    Also why doesn't WLS remove the hung threads?
    Steve
    "Ignacio G. Dupont" <[email protected]> wrote in message news:<[email protected]>...
    We have had a problem like yours with Weblogic 6.1 SP2 on Linux
    The problem is sun's implementation of the HTTP connections doesn't have a
    timeout, so if the other peer doesn't close the connection your threads will
    be "locked" on the connection.
    We have found searching the web that the Jakarta project has a package
    called Jakarta commons that implements HTTP connections with an
    setSoTimeout(int timeout) method so you can open the connections with your
    desired timeout. You have to download the code from the CVS as the released
    version doesn't support the timedout sockets yet.
    When support for the JDK 1.4 version will be announced by Bea you could use
    one of its new features that will allow you to pass arguments to the JVM to
    specify the maximum socket connection stablising timeout and the max
    inactivity on the socket too.
    Hope it helps you.
    Dimitri

  • Private field in a stateless session EJB

    Hi guys,
    I have a question about the design of a stateless session EJB.
    I would like to know :
    Does it make sense to put a private field in a stateless session bean???
    Imagine the following sitiation:
    I have a stateless session bean.
    Its job is to delegate the clients calls to some services (Java objects).
    These services are held in the private field and instatiated when WebLogic invokes
    the ejbCreate method.
    So I would like these services (Java objects) be instantiated before the clients
    invoke the bean's method for delegation - I mean, when WebLogic
    decides to create beans and put it in the pool (on the server startup for example).
    But what happens when the same bean once having finished its job is used by a
    different client???
    Are the services once instatiated available to the new client or WebLogic invokes
    the ejbCreate() method and the services are instatiated one more time???(which
    would be a performence killer)
    I must mention that in order to make the instatiation of the services possible,
    I presume I must implement the ejbCreate() method on the bean implementation class
    which invokes a private method doing the instatiation.
    So, do you think these design is a good design and what is its impact on the performence
    of the stateless session EJB ???
    Thank you.
    Freddy

    Rob Woollen <[email protected]> wrote:
    Freddy wrote:
    Hi guys,
    I have a question about the design of a stateless session EJB.
    I would like to know :
    Does it make sense to put a private field in a stateless session bean???
    Sure
    Imagine the following sitiation:
    I have a stateless session bean.
    Its job is to delegate the clients calls to some services (Java objects).
    These services are held in the private field and instatiated when WebLogicinvokes
    the ejbCreate method.
    So I would like these services (Java objects) be instantiated beforethe clients
    invoke the bean's method for delegation - I mean, when WebLogic
    decides to create beans and put it in the pool (on the server startupfor example).
    But what happens when the same bean once having finished its job isused by a
    different client???
    Are the services once instatiated available to the new client or WebLogicinvokes
    the ejbCreate() method and the services are instatiated one more time???(which
    would be a performence killer)
    WLS keeps the bean instances around in a pool. See
    http://edocs.bea.com/wls/docs81/ejb/session.html#1118700
    I must mention that in order to make the instatiation of the servicespossible,
    I presume I must implement the ejbCreate() method on the bean implementationclass
    which invokes a private method doing the instatiation.
    So, do you think these design is a good design and what is its impacton the performence
    of the stateless session EJB ???It's fine and a pretty common pattern.
    -- Rob
    Thank you.
    Freddy
    Thank you very much Rob.
    Freddy

  • Stateless Session EJB "Wait???"

    I need to let a Stateless Session EJB wait until 2:00 AM before it runs. How can I do that? I don't want to use a loop since it will eat up all system computing resource.
    Thanks
    Kenny

    Is that a way to code it? I don't want to use existing class. I need to control the EJB itself to "wait" for some time to run.
    Thanks
    Kenny

  • Stateless Session EJB Bean Example please

    Dear Friends,
    Develop a stateless session EJB bean and deploy it in WebLogic 8.1
    Please proivde me a weblogic8.1 example along with the deployment steps.
    Also mention the supporting softwares needed.
    I have weblogic 8.1, JDK 1.5
    Advance Thanks.
    Rengaraj.R

    Hi Rahul,
    Please paste the files here if they are small in size.
    IDfLoginInfo li = new DfLoginInfo(); //this is where the error occurs as when i remove this line. i dont get an error
    Have you checked this as I have mentioned something regarding this in my mail?
    Regards
    Vicky

  • Stateless session EJB invoke RMI

    Is it possible to invoke RMI calls from stateless session EJBs. It is my understanding
    restrictions exists like opening socket, file io, .. are not permitted from EJBs.
    Is there a way around.

    Vishal,
    I wouldn't think you would have a problem doing RMI communication from a Entity
    Bean - - for instance, when a WLS instance 'hosts' an EJB that communicates to
    a different WLS instance that 'hosts' an EJB that communication occurs via RMI.
    Chuck Nelson
    Developer Relations Engineer
    BEA Technical Support

  • Servicegen for stateless session EJB

    I've run into some minor trouble when I tried to generate
    web services for some stateless session EJBs with the
    servicegen Ant method. Note that expandMethods has been
    set to True. It appears that the generated web-services.xml
    file contains methods from the EJB's remote interface. When
    deploying the web service WLS will use the locale interface.
    If the remote interface has methods not found in the local
    interface WLS will refuse to deploy the web service. No big
    deal, since I could just add the missing methods to the
    local interface. But still, I think this is somewhat odd
    and inconsistent behavior. Is there anyway to get WLS to
    deploy the web services against the remote interfaces, or
    is this just a bad idea?
    /Björn

    Further information:
    According to metalink bug 3224465, this was a bug fixed in release 9.0.2.3.99 of the App Server. However, I am using 9.0.3.1 and still have the problem....

  • Deploy multiple instances of the same stateless session EJB

    I have a stateless session bean.
    The methods on the bean operate against DB tables.
    Q: Can I deploy multiple instances of the same stateless session bean, but specify a different JNDI/datasource name in the deployment descriptor?
    The method calls are all enclosed within a single invocation, just that I need to hit different databases (all with the same schema), and Id like to be able to lookup the EJB via a different JNDI name, and have the exact same functionality, just against different deployed datasources.
    Does the spec allow/support this?
    If not, any suggestions as to how to achieve this sort of functionality?
    Im using JBoss 3.2.1 on Solaris, so Im not sure whether or not this is a JBoss "issue" or a limitation of the EJB Spec (or me being just plain wrong and trying to do something the "wrong way")
    Nick

    I have a stateless session bean.
    The methods on the bean operate against DB tables.
    Q: Can I deploy multiple instances of the same
    stateless session bean, but specify a different
    JNDI/datasource name in the deployment descriptor?
    The method calls are all enclosed within a single
    invocation, just that I need to hit different
    databases (all with the same schema), and Id like to
    be able to lookup the EJB via a different JNDI name,
    and have the exact same functionality, just against
    different deployed datasources.
    Does the spec allow/support this?
    If not, any suggestions as to how to achieve this sort
    of functionality?
    Im using JBoss 3.2.1 on Solaris, so Im not sure
    whether or not this is a JBoss "issue" or a limitation
    of the EJB Spec (or me being just plain wrong and
    trying to do something the "wrong way")
    NickI haven't done it but judging from the deployment descriptors yes.
    For example if I have two bounded datasources java:/Database1 and java:/Database2
    Lets say I have a session bean called MySession, then in your ejb-jar.xml you would have (notice that the desc, display, and ejb-name are the only differences)
    <session>
    <description>MySessionAlpha</description>
    <display-name>MySessionAlpha</display-name>
    <ejb-name>MySessionAlpha</ejb-name>
    <home>com.mycorp.MySessionRemoteHome</home>
    <remote>com.mycorp.MySessionRemote</remote>
    <local-home>com.mycorp.MySessionLocalHome</local-home>
    <local>com.mycorp.MySessionLocal</local>
    <ejb-class>com.mycorp.MySessionFacadeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <res-ref-name>jdbc/DataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </session>
    <session>
    <description>MySessionBeta</description>
    <display-name>MySessionBeta</display-name>
    <ejb-name>MySessionBeta</ejb-name>
    <home>com.mycorp.MySessionRemoteHome</home>
    <remote>com.mycorp.MySessionRemote</remote>
    <local-home>com.mycorp.MySessionLocalHome</local-home>
    <local>com.mycorp.MySessionLocal</local>
    <ejb-class>com.mycorp.MySessionFacadeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <res-ref-name>jdbc/DataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </session>
    But now in the jboss.xml, we will have the following elements. What you may notice is that are bound to different remote and local jndi names. But the resource bindings are very different. The res-ref-name stays the same, but the jndi-name are different. I think this will work for you.
    <session>
    <ejb-name>MySessionAlpha</ejb-name> <jndi-name>ejb/com/mycorp/MySessionAlphaRemoteHome</jndi-name> <local-jndi-name>ejb/com/mycorp/MySessionAlphaLocalHome</local-jndi-name>
    <resource-ref>
    <res-ref-name>jdbc/datasource</res-ref-name>
    <jndi-name>java:/Database1</jndi-name>
    </resource-ref>
    </session>
    <session>
    <ejb-name>MySessionBeta</ejb-name> <jndi-name>ejb/com/mycorp/MySessionBetaRemoteHome</jndi-name> <local-jndi-name>ejb/com/mycorp/MySessionBetaLocalHome</local-jndi-name>
    <resource-ref>
    <res-ref-name>jdbc/datasource</res-ref-name>
    <jndi-name>java:/Database2</jndi-name>
    </resource-ref>
    </session>

  • Stateless session EJB as Web service adds root context prefix in embedded

    Hi,
    In JDeveloper 10.1.3.1 production (I'm pretty sure it didn't do it in the developer preview), if I run up a stateless session bean surfaced as a web service, then the root context gets prefixed with EJB- e.g. my application context is "services", so deployed to SOA suite the url is of the form:
    http://localhost:8888/services/webservice?WSDLbut if I run it up in embedded OC4J in JDeveloper, the URL is:
    http://localhost:8888/EJB-services/webservice?WSDL(I'm running embedded on port 8888 too to make deploy easier)
    which is causing a huge headache having to change loads of references to web services when moving between development, and deploy for test.
    I've tried mucking around no-end with J2EE application properties to get rid of the EJB- prefix, to no end, any help much appreciated.
    Cheers.

    Thanks for the reply.
    Afraid the context is just defined as services.
    I've done a bit more investigation, and if I simply run/debug the application, and it gets deployed under the default current-workspace-app, then the context gets the EJB- prefix. If I run up the embedded OC4J and manually deploy the application into it, then a new application (services) is created, and the context is correct (although I've now got the application deployed automatically under current-workspace-app, and manually under services, and so both URI's above now obviously work).
    This is probably a useable work-around, but still doesn't feel quite right.
    Cheers.

  • How is remote stateless session EJB removed, if clients don't remove() it

    I've seen code that doesn't call .remove, and Sun's tutorial also doesn't .remove(), despite the fact that the create() call is made:
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/EJB4.html#wp79902
    My questions are:
    1. .create() instantiates a new remote instance, doesn't it?
    2. since clients don't call .remove(), how does the remote instance get ejbRemove()d?
    2.1. Does perhaps the home instance of such ejb cause removal upon finalize()? I've seen some auto-generated EJB stubs, but i don't see that being the case.

    Clients do have the option of calling remove() but the behavior depends on the kind of
    session bean.
    For stateless session beans, calling remove() doesn't have much value since the lifetime
    of the bean instances in the container is decoupled from the client. An ejb container
    is free to use the remove call as a hint, but in general the container will clean up instances
    when it deems it necessary. Most implementations define a number of configuration
    parameters to control this, e.g., max-pool-size.
    For stateful session beans, calling remove() will indeed remove that session bean identity,
    whether it's in memory or it has been passivated. Even in the absence of an explicit
    client call to remove(), the container is still free to remove a stateful session bean.
    Most implementations define a set of timeout parameters that control this behavior.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error running "Develop a Stateless Session EJB Web Service using EJB 3.0"

    Running this "how-to," the build and deploy worked fine for me, but when I ran "ant run," I got:
    [echo] -----> Setting up the application client module
    [oracle:genProxy] null, WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb30ws/ejb30ws?wsdl is not a wsdl file or does not have a root element of "definitions" in the "http://schemas.xmlsoap.org/wsdl/" namespace or the "http://www.w3.org/2004/08/wsdl" namespace.

    Debu,
    Yes, it successfully deployed.
    Here are the messages from the failed run.
    BUILD SUCCESSFUL
    Total time: 33 seconds
    D:\Oracle_ejb3.0\demo\howtoejb30ws>ant run
    Buildfile: build.xml
    common:
    [echo] BuildName: ejb30ws
    [echo] BuildHome: D:\Oracle_ejb3.0\demo\howtoejb30ws
    [echo] BuildFile: D:\Oracle_ejb3.0\demo\howtoejb30ws\build.xml
    [echo] BuildJVM: 1.5
    oracle-env-check:
    java-env-check:
    init:
    [echo] -----> Initializing project properties
    setup:
    [echo] -----> Creating the required sub-directories
    cli-setup:
    [echo] -----> Setting up the application client module
    [oracle:genProxy] null, WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb
    /ejb30ws?wsdl is not a wsdl file or does not have a root element of "definitions" in the "http://schem
    mlsoap.org/wsdl/" namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    [oracle:genProxy] WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb30ws/e
    ws?wsdl is not a wsdl file or does not have a root element of "definitions" in the "http://schemas.xml
    .org/wsdl/" namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    BUILD FAILED
    D:\Oracle_ejb3.0\demo\howtoejb30ws\build.xml:316: oracle.j2ee.ws.common.tools.api.WsdlValidationExcept
    null, WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb30ws/ejb30ws?wsdl
    not a wsdl file or does not have a root element of "definitions" in the "http://schemas.xmlsoap.org/ws
    namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    Total time: 3 seconds
    D:\Oracle_ejb3.0\demo\howtoejb30ws>

  • 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

  • Calling Local Stateless session bean from Spring in weblogic 10.3

    We are in the process of upgrading to Weblogic 10.3 from OC4J (OAS). We are using Spring and Stateless Session EJB 3 Local beans (Don't ask me why, it is decided before I came to the project).
    Previously (OC4J):
    -> There is no ejb-jar.xml. EJBs are configured with annotation @Stateless. No "name" or "mappedName" are defined.
    Spring POJOs access EJBs by using "EJBMODULENAME_<<EJBBeanClass>>Local" as JNDI Name. I think this strange JNDI name is what OC4J assigns when there is no explicit JNDI name defined.
    Sample Spring Bean configuration -
    <bean name="securityEJB" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" lazy-init="true">
              <property name="jndiName">
                   <value>myapp-ejb_SecurityEJBImplLocal</value>
              </property>
              <property name="resourceRef">
                   <value>false</value>
              </property>
              <property name="businessInterface">
                   <value>my.package.SecurityEJB</value>
              </property>
         </bean>
    I understand that weblogic 10.x doesn't give any global JNDI name (JNDI tree is empty) and also looked at the blog, Link: [http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html]
    So far I have tried,
    1. @EJB annotation works but, I don't want to add @EJB annotations in the entire application. Since we are using Spring and EJB3, I am trying to avoid mixing them -
    2. java:comp/env is supposed to work (since it is a local session bean), but it doesn't for me.
    I haven't added weblogic-ejb-jar.xml as I don't think it is going to help, as there is no global JNDI name defined. Am I missing some thing?
    Thx

    Hi,
    if you don't want to use @EJB to inject the EJB, then you'll need declare the EJB reference in deployment descriptor.
    Here is an example copied from EJB3 spec:
    <ejb-local-ref>
    <description>
    This is a reference to the local business interface
    of an EJB 3.0 session bean that provides a payroll
    service.
    </description>
    <ejb-ref-name>ejb/Payroll</ejb-ref-name>
    <local>com.aardvark.payroll.Payroll</local>
    </ejb-local-ref>
    then you can lookup the local ejb from "java:comp/env/ejb/Payroll".

Maybe you are looking for