users@glassfish.java.net

Re: Multithreaded access to DataSource resource

From: sankara rao bhogi <Sankara.Rao_at_Sun.COM>
Date: Wed, 06 Jun 2007 15:22:55 +0530

Are you doing this from a stand alone client or appclient? If yes, a
workaround is to do the look up once in the main thread and there after
you could use mutlithreaded access.

regards
sankar
glassfish_at_javadesktop.org wrote:
> Hello!
> I've problems when try to multithreaded access to DataSource. Code below reproduce this:
> ---------------------------
> private class TestThread extends Thread
> {
> public void run()
> {
> try
> {
> Context c = new InitialContext();
> c.lookup("jdbc/__default");
> }
> catch (NamingException e)
> {
> throw new RuntimeException(e);
> }
> }
> }
>
> public void test() throws InterruptedException
> {
> Thread t1 = new TestThread(), t2 = new TestThread();
> t1.start(); t2.start();
> t1.join(); t2.join();
> }
> ---------------------------
> And exception is:
> 06.06.2007 13:13:05 com.sun.jts.CosTransactions.DefaultTransactionService identify_ORB
> WARNING: JTS5015: Unexpected error occurred when creating portable object adaptors
> org.omg.PortableServer.POAPackage.AdapterAlreadyExists: IDL:omg.org/PortableServer/POA/AdapterAlreadyExists:1.0
> at com.sun.corba.ee.impl.oa.poa.POAImpl.create_POA(POAImpl.java:769)
> at com.sun.jts.CosTransactions.DefaultTransactionService.createPOAs(DefaultTransactionService.java:418)
> at com.sun.jts.CosTransactions.DefaultTransactionService.identify_ORB(DefaultTransactionService.java:225)
> at com.sun.enterprise.iiop.PEORBConfigurator.initTransactionService(PEORBConfigurator.java:205)
> at com.sun.enterprise.connectors.ConnectionManagerImpl.initialize(ConnectionManagerImpl.java:383)
> at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:128)
> at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
> at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:344)
> at javax.naming.InitialContext.lookup(InitialContext.java:351)
> at ru.tests.ejb.test.Test3$TestThread.run(Test3.java:50)
> -------------------------------------
> Any suggestions?
> Thanks.
>
> GF2, b46
> [Message sent by forum member 'sinus' (sinus)]
>
> http://forums.java.net/jive/thread.jspa?messageID=220748
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>