Multiple instances of a service from a bean

Hi all,
I have a class that provides a service, however there can multiple instances of this object and I need to retrieve all instances of the service. A simplified version of my function is:
public MyService getMyService() throws Exception
if (_myService == null)
myService = (MyService)getBeanContextServices().getService(bccs, this, myService.class, null, new MyServiceRevokedListener());
return _myService;
I guess that I need to return a Collection of MyService objects from this function. When I call getService(...) there is only on instance returned (not surprising really). I have been searching through the documentation for a function that will return all instances of a service. This sounds like functionality that I would have expected to be provided by the API so before I write application specific code, I was wondering if anyone out there could offer some advice.
Any thoughts and suggestions would be appreciated.
Regards,
Chris

You mean likepublic MyService[] getMyServices()...? If you're looking for an API that returns a set of resources, try java.awt.GraphicsEnvironment.

Similar Messages

  • [Solved] Launching multiple instances of a service from systemd timer

    I have a short script that I want to run every 5 seconds.  I've set up a systemd timer, which runs the script every 5 seconds, assuming the script terminates before the next elapse of the timer.  However, if the script is still running when the timer elapses, systemd sees that the service is already active, so it does not run my script again. 
    How can I make my script run in another instance, every 5 seconds, even in cases where the script is still running from an earlier elapse of the timer? 
    I'd like to keep everything managed by systemd, in that it should capture stdout into the journal.  I've looked at using a systemd socket unit with ListenStream pointing to a file system socket, where the socket-activated service template runs my script.  Then, a timer unit runs a script that calls socat to send a single character to the file system socket to spin up an instance.  The nice thing about this approach is that systemd can manage limiting the number of socket activations that can be spun up.  However, I haven't gotten this idea to work yet. 
    Here's my test script, which I can cause to run for a long time by creating a lockfile. 
    [root@dogbert system]# cat /var/lib/misc/test1.py
    #!/usr/bin/python2
    import os
    import time
    import sys
    print "%d starting..." % os.getpid()
    sys.stdout.flush()
    while os.path.exists("/tmp/test1.lockfile"):
    print "%d sleeping..." % os.getpid()
    sys.stdout.flush()
    time.sleep(1.0)
    print "%d exiting..." % os.getpid()
    Here are my unit files:
    [root@dogbert system]# cat /etc/systemd/system/test1.timer
    [Timer]
    OnBootSec=1min
    OnCalendar=*:*:0/5
    AccuracySec=50ms
    [Install]
    WantedBy=timers.target
    [root@dogbert system]# cat /etc/systemd/system/test1.service
    [Service]
    Type=oneshot
    ExecStart=/var/lib/misc/test1.py
    Here's what happens if I create the lock file and then remove it.  The script does not run at 10:39:30, but I get one "catch-up" run of the script at 10:39:32. 
    May 02 10:39:20 dogbert test1.py[10209]: 10209 starting...
    May 02 10:39:20 dogbert test1.py[10209]: 10209 exiting...
    May 02 10:39:25 dogbert test1.py[10228]: 10228 starting...
    May 02 10:39:25 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:26 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:27 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:28 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:29 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:30 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:31 dogbert test1.py[10228]: 10228 sleeping...
    May 02 10:39:32 dogbert test1.py[10228]: 10228 exiting...
    May 02 10:39:32 dogbert test1.py[10250]: 10250 starting...
    May 02 10:39:32 dogbert test1.py[10250]: 10250 exiting...
    May 02 10:39:35 dogbert test1.py[10269]: 10269 starting...
    May 02 10:39:35 dogbert test1.py[10269]: 10269 exiting...
    May 02 10:39:40 dogbert test1.py[10287]: 10287 starting...
    May 02 10:39:40 dogbert test1.py[10287]: 10287 exiting...
    Last edited by johnp636 (2015-05-05 01:22:35)

    johnp636 wrote:However, if the script is still running when the timer elapses, systemd sees that the service is already active, so it does not run my script again.
    That's normal, you cannot start again an already active service unit, which is what the timer tries to do if the next trigger comes before the service ends.
    How can I make my script run in another instance, every 5 seconds, even in cases where the script is still running from an earlier elapse of the timer?
    I don't think that a timer can do this with a simple service.
    But a shell script can manage this.
    I'd like to keep everything managed by systemd, in that it should capture stdout into the journal.
    The command 'systemd-cat' can be used in the shell script to get this feature.
    I propose this bash script:
    #!/bin/bash
    nbprocess=0
    while true; do
    if ((nbprocess <= 2)); then
    systemd-cat /var/lib/misc/test1.py &
    fi
    nbprocess=$(pgrep test1.py|wc -l)
    sleep 5
    done
    It limits the number of test1.py processes to 3.
    This script can be started with a service unit, without using a timer:
    [Service]
    ExecStart=/var/lib/misc/test1.sh
    Stopping this service, will end all the running test1.py processes.
    Maybe there is a better way to do this, but this method is simple; if I find something else, I will post again.

  • Upon computer startup: "Atte​mpted to start multiple instances of the service&qu​ot;

    Recently installed Diadem and there must be some sort of registry error.  Whenever I startup I get the error "Attempted to start multiple instances of the service" anyone know the registry fix for this? Thanks!
    Attachments:
    NI startup error.jpg ‏16 KB

    Hey Kyle,
    Check your services and see what’s running.  This can be done by going to Start>>Run and type “services.msc”.   Then look for anything that starts with National Instruments or NI.  Look to see if there are any entries running twice or if you are trying to call a service that is already running.
    Nick
    National Instruments
    Applications Engineer

  • Running multiple instances of a service

    ello,
    is it possible (and not "tabooed") to run multiple instances of an application that is designed to be service?
    Im intending to use the Java Service Wrapper to have my app run as a service, but im wondering if it is possible to run multiple instances of my application wrapped in the wrapper.
    What about starting the service using command line arguments?
    This is some details of my scenario:
    Im developing a server that will run without threading - it will read client requests that have been saved by the clients into a database. Thus im going to have an infinite while loop that just keeps reading the db for unprocessed client requests.
    When it is noticed that the load has increased then more than one instance of the server will be necessary.
    if im using the java service wrapper to run my server as a service will it be possible to achieve the above?
    thanks.

    one more thing : if i make any changes in the wrapper.conf xml file for the java service wrapper will the config be automatically loaded?

  • Generating web service from session bean

    Hi
    I have a session bean in one project which has a service-endpoint defined.
    My web services are in another project entirely, within the same workspace if that helps any.
    When I generate the web service from the EJB JDev turns the business tier project into a web project,
    I don't see any options to include the web service in the web project.
    I've reversed all of the changes, but wonder if I shouldn't redo it and copy the mapping file and configuration
    across to the web project and reverse the changes in the business tier.
    This is a workaround that I'm hoping to avoid, as I'm doing the "howto" for this in our project.
    How is this normally done?

    I tried generating the web servioce from WSDL, in the web project.
    I tested and the web service works fine.
    Then I changed the config file to point to the ejb, but the server won't start up....
    *08/09/17 10:58:40 WARNING: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.*
    This is the webservices.xml bit I updated...
         <ejb-link>SomeOrOtherEjbName</ejb-link> The bit I found in webservices.xml when the service is in the business tier.
    <!-- <servlet-link>SomeOrOtherWebServiceSoapHttpPort</servlet-link> --> The service that works in the web tier.

  • Create a web service from java bean and map exceptions to SOAP faults

    Hi,
    We have to expose our Session stateless EJB3 as web services. I've tried to use annotations and jdev wizard "java bean to web service" and it works fine.
    Our problem now is that our methods can throw a business exception that contains a list of error message strings to be presented on the client.
    I did not find any way to use annotations to make it build a wsdl with soap fault mapped to our exception class. Neither I could to make the wizard to create wsdl with faults.
    As we are exposing already designed and implemented classes as web services, I think the bottom-top (java->wsdl) approach is better that top->botton (wsdl->java). Therefore, I'm looking for a possibility to generate the web services from the java beans and have the exception be mapped to a soap fault message.
    We are using jdev 10.1.3.1 and OAS 10.1.3.1., is there a way to map exceptions to soap faults using bottom->top approach?
    thank you

    A couple of links that may be of help:
    http://www.netbeans.org/servlets/ReadMsg?listName=nbj2ee&msgNo=1218
    My last question concerning web services:
    I have already written a session bean and I'd like to add some methods
    as a web service to it, how do I do that?
    Or I can only create another bean for a webservice and cannot modify the
    original one?You might create web service with existing sources and select you bean. New web services with appropriate lookup method will be generated.
    All web service method, that will be exposed in web service, you
    should add itself (Pop-up menu Web Service -> Add operation)
    http://usersguide.netbeans.org/files/documents/40/73/Chapter9-WebServices.pdf

  • Validate Multiple Inputtext and launch validation from backing bean

    Hi to all
    How can i validate multiple inputtext in a form?
    And how can i launch a validation from backin bean?
    Thanks

    Thank you very much, that is what i was looking for.
    I have one more problem:
    if i make this, it's showing me an error, i can't do it
    FacesContext context= FacesContext.getCurrentInstance();
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Value entered is invalid");
    msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "component level message - Value entered is invalid");
    context.addMessage(FacesContext.getCurrentInstance().getViewRoot().findComponent("<id_of_the_inputtext_component"), msg);
    context.addMessage takes only two strings as arguments
    Edited by: 838674 on 23-mar-2011 4.56

  • How to use WS-RM web Service from Session Bean?

    Hi all.
    Could you tell me the way how to call WS-RM web service(Staring BPM Process) from SessionBean?
    Our environment: SAP NetWeaver CE 7.2 SP3
    I do the following.
    I have created a BPM Process starting with Message Start Event.
    This Message Start Event was created by Service Interface(stateless and asynchronous) which was imported from ESR.
    I deployed this into my server and it worked fine in webservice navigator as a WS-RM WebService.
    But I can't call this webservice from SessionBean in EJBExplorer.
    I get the following error message:
    Caused by: This exception is wrapper of javax.xml.ws.soap.SOAPFaultException. com.sap.engine.services.webservices.espba
    se.client.bindings.exceptions.SOAPFaultException: Invalid WS-RM message. There are no WS-RM headers within SOAP message.
    at com.sap.engine.services.webservices.espbase.client.bindings.impl.JAXWSUtil.processFault(JAXWSUtil.java:412)
    at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call_SOAP(SOAPTransportBinding.java:1366)
    at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.callWOLogging(SOAPTransportBinding.java:960)
    at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call(SOAPTransportBinding.java:915)
    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:168)
    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEISyncMethod(WSInvocationHandler.java:121)
    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEIMethod(WSInvocationHandler.java:84)
    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invoke(WSInvocationHandler.java:65)
    at $Proxy2753.zwsvCheckOrderdataMainprocessStart(Unknown Source)
    at jp.co.ogis_ri.WSTestSessionBean.exeWS(WSTestSessionBean.java:81)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    I created this SessionBean as follows:
    I created DCs for EJB and created SessionBean in EJB DC.
    I imported a WSDL file(WS-RM web service) from Service Registory and
    I created service clients and Service References.
    After that I implemented SessionBean to call web service checking with this help.
    http://help.sap.com/saphelp_nwce72/helpdata/en/44/4d2bb1c6b00597e10000000a155369/frameset.htm
    After deploying this EJB,I configured properties in nwa.
    Thanks
    Yuichi

    Yuichi
    Did you manage to solve this?  I'm doing something similar and seeing the same problem, although they're up to 7.3 SP7.
    Any help greatly appreciated.
    Lewis

  • Creating web services from session beans

    Hi everybody,
    I want to know how to generate web services using session beans in Weblogic Worshop.
    I need this urgently!!!
    Any help will be very much appreciated.
    Can anybody please help me......
    Thanks,
    Neelima

    Hello,
    Have you tried the tutorial?
    http://e-docs.bea.com/workshop/docs81/doc/en/wls/tutorial/ejbtutorial.html
    For urgent help, please make use of our excellent support team:
    http://support.bea.com
    Thanks,
    Bruce
    Neelima wrote:
    >
    Hi everybody,
    I want to know how to generate web services using session beans in Weblogic Worshop.
    I need this urgently!!!
    Any help will be very much appreciated.
    Can anybody please help me......
    Thanks,
    Neelima

  • Problem invoking gogle web service from session bean

    Hello
    I have developed a Web-Client which consumes the google-WebService with Apache Axis. I have generated the corresponding classes with WSDL2Java and the client works without problems. A little code fragment from my client:
    GoogleSearchService service = new GoogleSearchServiceLocator();
              // Now use the service to get a stub to the Service Definition Interface (SDI)
              GoogleSearchPort google = service.getGoogleSearchPort();
             GoogleSearchResult googleSearchResult =  google.doGoogleSearch(GOOGLE_KEY, // java.lang.String key
                           q.toString(), //java.lang.String q
                           0, // int start
                           10, // int maxResults
                           false, //boolean filter
                           "", // java.lang.String restrict      
                           false, //boolean safeSearch              
                           "lang_ja|lang_en", // java.lang.String lr
                           "UTF-8", // java.lang.String ie
                           "UTF-8"); // java.lang.String oeNow I have to put the Web-Client in a SessionBean. Therfore I defined the code of the web-client in a method and put it into a stateless session bean and wrote a client for the session bean. But when the session bean invokes the corresponding method for consuming the google web service, there always occurs the following error:
    [java] Exception in thread "main" java.rmi.ServerError: Unexpected Error; nested exception is:
    [java] java.lang.NoClassDefFoundError: GoogleSearch/GoogleSearchService
    But I have definitely all necessary classes in my classpath, like GoogleSearchService, etc. So all necessary classes are available. And the code to conume the web service als works because as said I tested it with a web-client.
    Has anybody an idea what went wrong here? Is there anything important when I a web service is invoked by a session bean??:(
    regards
    pat

    Has nobdy an idea?? :(( I tried for such a long time but I was not able to fix this problem....:(
    Please help...

  • Calling a web service from Session bean

    Hi Experts,
    Can anybody help in calling a web serivce frm a session bean's business method??
    Hw do we do that?
    I have one requirement where i want to send emails to set of users for which i have email sending web service ready.. How can i call it thru a session bean's business method???
    Pls help,
    Regards,
    Amey

    Hi Amey,
    This documents explains how to use an EJB as Web service endpoint: http://help.sap.com/saphelp_nwce10/helpdata/en/46/307a6c50094f09e10000000a114a6b/frameset.htm
    I hope this helps.
    Best regards,
    Ekaterina

  • Attempted to start multiple instances of the service

    After installing LabVIEW 8.5.1, I keep getting this message after a computer reboot.  It does not say what multiple services are running.  Anyone seen this before?

    SumTumWong-
    Check your services and see what’s running.  This can be done by going to Start>>Run and type “services.msc”.   Then look for anything that starts with National Instruments or NI.  Look to see if there are any entries running twice or if you are trying to call a service that is already running.
    Regards,
    Mike S
    NI AE

  • How to execute multiple methods of application module from managed bean using operation binding

         im using jdev 11.1.2.3
    gettiing error..........in my page as below
    java.lang.NullPointerException
    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1
    and weblogic log as below
    RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
    javax.servlet.ServletException
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:521)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
        at java.security.AccessController.doPrivileged(Native Method)
        at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
        at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
        at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
        at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
        at view.com.pof.admin.users.POFAdminUser.createPasswordHistory(POFAdminUser.java:64)
        at view.com.pof.admin.users.POFAdminUser.performOperationBinding(POFAdminUser.java:49)
        at view.com.pof.admin.users.POFAdminUser.saveData(POFAdminUser.java:28)
        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:597)
        at com.sun.el.parser.AstValue.invoke(Unknown Source)
        at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
        at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1545)
        at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
        at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
        ... 38 more

    User, I fail to understand what your header (of the question) has to do with the stack trace. You get a npe in your code
    view.com.pof.admin.users.POFAdminUser.createPasswordHistory(...)
    This is the point where I would start my investigation.
    Timo

  • Multiple Instances created for a web service in OWSM

    Hi,
    I have created a gateway and added some services to the gateway. When i am invoking the webservice through the gateway, multiple instances of the service are created in bpel console.
    I have done everything as per the OWSM guide.
    Urgent Issue.
    Thanx in advance.

    Dear Nikhil,
    Please check that item is relevant for Text item,
    Check the copy control settings between sales order type and delivery type in VTLA transaction.
    I hope it will help you,
    Regards,
    Murali.

  • 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