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....

Similar Messages

  • EJB Deployment Problem for Stateless Session with Multiple ejbCreate

    In weblogic server if I use multiple ejbCreate with different parameters it is found
    to raise error with error message :
    <Error deploying application cart:
    Unable to deploy EJB: cart.jar from cart.jar:
         In EJB CartBean, the stateless session bean class must define a single ejbCreate
    method that takes no parameters.
         at weblogic.ejb20.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:256)
         at weblogic.ejb20.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:220)
         at weblogic.ejb20.ejbc.EJBCompiler.complianceCheckJar(EJBCompiler.java:453)
         at weblogic.ejb20.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:410)
         at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:203)
         at weblogic.ejb20.deployer.Deployer.runEJBC(Deployer.java:296)
         at weblogic.ejb20.deployer.Deployer.compileEJB(Deployer.java:676)
         at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:843)
         at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:30)
         at weblogic.j2ee.Application.addComponent(Application.java:160)
         at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
         at ......
    Code example...
    public void ejbCreate() throws CreateException {}
    public void ejbCreate(String person) throws CreateException {
    // code here
    public void ejbCreate(String person, String id) throws CreateException {
    // code here
    the code above is found ok in J2ee Ref. Implementation and able to deploy. Why this
    is not deployable in Weblogic(tried in 6.1).is it a required condition for stateless
    session bean
    to have only single ejbcreate with no parameters ?
    Can somebody explain? and is there a way out to overcome this constraint if so in
    weblogic
    with regards
    Ganeshan Kalembeth

    Stateless session beans may define only a single create() method with no
    suffix
    and no arguments.
    Michael Jouravlev wrote:
    "Ganeshan Kalembeth" <[email protected]> wrote in message
    news:3ce28a88$[email protected]..
    In weblogic server if I use multiple ejbCreate with different parametersit is found
    to raise error with error message :
    <Error deploying application cart:
    Unable to deploy EJB: cart.jar from cart.jar:
    In EJB CartBean, the stateless session bean class must define a singleejbCreate
    method that takes no parameters.
    atweblogic.ejb20.compliance.EJBComplianceChecker.check(EJBComplianceChecker.ja
    va:256)
    atweblogic.ejb20.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBCompli
    anceChecker.java:220)
    atweblogic.ejb20.ejbc.EJBCompiler.complianceCheckJar(EJBCompiler.java:453)
    at weblogic.ejb20.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:410)
    at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:203)
    at weblogic.ejb20.deployer.Deployer.runEJBC(Deployer.java:296)
    at weblogic.ejb20.deployer.Deployer.compileEJB(Deployer.java:676)
    at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:843)
    at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:30)
    at weblogic.j2ee.Application.addComponent(Application.java:160)
    at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
    at ......
    Code example...
    public void ejbCreate() throws CreateException {}
    public void ejbCreate(String person) throws CreateException {
    // code here
    public void ejbCreate(String person, String id) throws CreateException {
    // code here
    the code above is found ok in J2ee Ref. Implementation and able to deploy.Why this
    is not deployable in Weblogic(tried in 6.1).is it a required condition forstateless
    session bean
    to have only single ejbcreate with no parameters ?
    Can somebody explain? and is there a way out to overcome this constraintif so in
    weblogic
    with regards
    Ganeshan KalembethRTFM EJB 2.0 Spec, chapter 7.8

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

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

  • Is it possible to restrict the object creation for stateless session beans

    Hi,
    Is it possible to restrict/fix the ejb object creation for stateless session beans in application server?
    For example, i want to configure the application server ( am using JBOSS ) to create maximum of 10 session bean objects. and if any requests for the stateless session bean come, as application server has created 10 objects, the requests should be blocked.
    Thanks in advance,
    nvseenu

    You can keep a counter in the application code. A static var won't work, but an entity and a consistent id should. This version would affect performance, but it would be portable to other app servers.
    // ConstrainedBean.java
    package unq.ejb;
    import javax.ejb.Stateless;
    import javax.ejb.CreateException;
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.persistence.PersistenceContext;
    import javax.persistence.EntityManager;
    @Stateless
    public class ConstrainedBean implements Constrained {
        final static int DEFAULT_COUNTERID = 1;
        @PersistenceContext EntityManager em;
        @PostConstruct
        protected void init() throws CreateException {
         ConstrainedBeanCounter counter =
             em.find(ConstrainedBeanCounter.class, DEFAULT_COUNTERID);
         if( counter == null ) {
             counter = new ConstrainedBeanCounter();
             counter.counterId = 1;
             counter.counterValue = 0;
             em.persist(counter);
         if( counter.atMaximum() ) {
             throw new CreateException("error attempting to create > 10 beans");
         else {
             counter.increment();
        @PreDestroy
        protected void destroy() {
         ConstrainedBeanCounter counter = em.find(ConstrainedBeanCounter.class,
                                   DEFAULT_COUNTERID);
         counter.decrement();
        public void doSomething() { System.out.println("doSomething()"); }
    // ConstrainedBeanCounter.java
    package unq.ejb;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    @Entity
    public class ConstrainedBeanCounter implements java.io.Serializable
        @Id public int counterId;
        public int counterValue = 0;
        public void increment() {
         counterValue++;
        public void decrement() {
         counterValue--;
        public boolean atMaximum() {
         return counterValue > 9;
    }

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Creating a simple java client for a session EJB local interface

    Hi all
    Is it possible to create a simple java client for a session ejb local interface with JDeveloper.
    The problem is that it creates a test client for a remote interface only...
    i.e.
    MySessionEJB sessionEJB = context.lookup("MySessionEJB")
    and once i try to adjust it manually for the local interface...
    MySessionEJBLocal sessionEJB = (MySessionEJBLocal) context.lookup("MySessionEJBLocal") (MySessionEJBLocal - is the name of my local interface)
    it generates the exception:
    javax.naming.NotFoundException: SessionEJBLocal not found
    at...........................(RMIClientContext.java:52)
    There is still no problem with accessing the local interface object from the jsf project where i've added <ejb-local-ref> tag into the web.xml file.
    but i need the possibility of testing the simple java client for the local interface to test business methods wich should return objects without indirect properties
    Thanks in advance.
    Alex.

    Pedja thanks for reply.
    I still dont understand what is wrong with my example.
    The first peace of the code i wrote (getting the reference to the remote interface object) works pretty well, and even more it is produced automatically by JDeveloper, so why we cant get a reference to the local interface object the same way?
    Certanly we should use the local interface for getting access to the resource functioning under the same local jvm and i think it doesnt metter wich app server we really use wls or oas or others
    Thanks. Alex.

  • 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

  • Weblogic-ejb-jar.xml for a Session EJB

    The weblogic-ejb-jar.xml generated for a Session EJB with local interfaces has a jndi-name element instead of local-jndi-name.
    1. Create a Session EJB.
    Select Include Local Interfaces.
    2. In the META-INF directory select New>General>Deployment Descriptors>weblogic-ejb-jar.xml
    The deployment descriptor generated has a jndi-name element.
    For a Session EJB with local interfaces the element should be local-jndi-name.
    thanks,
    Deepak

    weblogic-ejb-jar.xml jndi-name (instead of local-jndi-name) is with JDeveloper version 10.1.2 & 10.1.3

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

Maybe you are looking for

  • Can not start DAC server

    Hi , I am getting following error while trying to start the DAC server . May 3, 2011 11:10:19 PM com.siebel.etl.bootup.DAWUtils checkPermission SEVERE: Checking the localhost with the values defined in the DAC repository! May 3, 2011 11:10:19 PM com.

  • Mapping in interconnect between different Business Objects

    I want to know how to do transformation and mapping between different business objects in interconnects. Always,We have a very complex SQL,when We do intergration with Oracle interconnect ,We use DB Adapter or Jdbc Adapter,but the complex SQL have to

  • I Need Help In Deleting Table row by clicking on "Delete" button inside the

    Dear all, first i'm new to Swing i have created table with customized table model, i fill this table using 2d array, this table rows contains JButtons rendered using ButtonRenderer.java class and action listeners attached by the AbstractButtonEditor.

  • Where is the mod_jk2.dll?

    hello I'm trying to install jk2 connector. My problem is that in the .zip distribution on Jakarta site, I can't find the mod_jk2.dll that must be given to httpd.conf in Apache. Instead of it, I find a mod_jk2.so, which is the Unix/Linux equivalent. I

  • Data guard performance problem (rac to single instance)

    i have a table it has GPS data, and gps table has too many data, 5 millions, iam using RAC (2 nodes 11gr2). standby database is single instance data guard, single instance database (standby)'s hardware cpu is lower than RAC machines. rac nodes have (