users@glassfish.java.net

Re: Establishing two Connections in One Application - One javax.jms.Connection, the other java.sql.Connection

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Fri, 29 Feb 2008 11:27:33 +0530

> Class name is wrong or classpath is not set for :
> com.informix.jdbcx.IfxDataSource

I guess you are doing lookup of datasource within the appclient. If so,
jdbc drivers need to be accessible (in the classpath) by the appclient
container.

Thanks,
-Jagadish



On Thu, 2008-02-28 at 14:36 -0800, rdblaha1 wrote:
> I am trying to write an application (eventually an EJB) that consumes
> a
> message from a JMS Message queue and then write the parse message
> information into a table in my database using a connection pool
> thread.
>
> I have the following question areas.
>
> 1) I set up the import javax.jms.Connection and then import
> java.sql.Connection. Netbeans gives the following error message next
> to the
> java.sql.Connection: 'javax.jms.Connection is already defined in a
> single-type import.' How can I import both for use? or what other
> means is
> available?
>
> 2) My attempt at bypassing the first situation is by doing the
> following:
>
> javax.jms.Connection connection = null;
> Session session = null;
> Destination dest1 = null;
> Destination dest2 = null;
> MessageConsumer consumer = null;
> MessageProducer producer = null;
> TextMessage messageConsumer = null;
> TextMessage messageProducer = null;
>
> java.sql.Connection sqlConn = null;
>
> sqlConn = jdbcIfxDevel.getConnection(); // for default
> uid/pwd
> <--- Failure point for the following stacktrace.
>
> However, after I deploy my application on the app server (via the
> Admin
> Console), I then try to run it using the appclient utility I get the
> following:
>
> # /opt/SUNWappserver/bin/appclient -client
> dist/MyConsumerReaderDatabaseWriter.jar queue
> Feb 28, 2008 5:22:10 PM com.sun.gjc.common.DataSourceObjectBuilder
> getDataSourceObject
> SEVERE: RAR5099 : Wrong class name or classpath for Datasource Object
> java.lang.ClassNotFoundException: com.informix.jdbcx.IfxDataSource
> at
> com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:737)
> at
> com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:627)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at
> com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:242)
> at
> com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:109)
> at
> com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:972)
> at
> com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:141)
> at
> com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:95)
> at
> com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:68)
> at
> com.sun.enterprise.resource.AbstractResourcePool.createSingleResource(AbstractResourcePool.java:891)
> at
> com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(AbstractResourcePool.java:1750)
> at
> com.sun.enterprise.resource.AbstractResourcePool.createResources(AbstractResourcePool.java:917)
> at
> com.sun.enterprise.resource.AbstractResourcePool.initPool(AbstractResourcePool.java:225)
> at
> com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(AbstractResourcePool.java:516)
> at
> com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:443)
> at
> com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
> at
> com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:327)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:235)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
> at
> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
> at
> com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:108)
> at
> com.davisco.mtr.server.MyConsumerReaderDatabaseWriter.main(MyConsumerReaderDatabaseWriter.java:103)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:417)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
> at com.sun.enterprise.appclient.Main.main(Main.java:200)
> Feb 28, 2008 5:22:11 PM
> com.sun.enterprise.resource.LocalTxConnectorAllocator createResource
> WARNING: RAR5038:Unexpected exception while creating resource
> Feb 28, 2008 5:22:11 PM
> com.sun.enterprise.connectors.ConnectionManagerImpl
> internalGetConnection
> WARNING: RAR5117 : Failed to obtain/create connection from connection
> pool [
> ifxDevel ]. Reason : Class name is wrong or classpath is not set for :
> com.informix.jdbcx.IfxDataSource
> Feb 28, 2008 5:22:11 PM com.sun.gjc.spi.base.DataSource getConnection
> WARNING: RAR5114 : Error allocating connection : [Error in allocating
> a
> connection. Cause: Class name is wrong or classpath is not set for :
> com.informix.jdbcx.IfxDataSource]
> Feb 28, 2008 5:22:11 PM
> com.sun.enterprise.appclient.MainWithModuleSupport
> <init>
> WARNING: ACC003: Application threw an exception.
> java.sql.SQLException: Error in allocating a connection. Cause: Class
> name
> is wrong or classpath is not set for :
> com.informix.jdbcx.IfxDataSource
> at
> com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
> at
> com.davisco.mtr.server.MyConsumerReaderDatabaseWriter.main(MyConsumerReaderDatabaseWriter.java:103)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:417)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
> at com.sun.enterprise.appclient.Main.main(Main.java:200)
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:428)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
> at com.sun.enterprise.appclient.Main.main(Main.java:200)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
> at
> com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:417)
> ... 2 more
> Caused by: java.sql.SQLException: Error in allocating a connection.
> Cause:
> Class name is wrong or classpath is not set for :
> com.informix.jdbcx.IfxDataSource
> at
> com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
> at
> com.davisco.mtr.server.MyConsumerReaderDatabaseWriter.main(MyConsumerReaderDatabaseWriter.java:103)
> ... 8 more
> #
>
> I have run my program 'successfully' (as far as it can go without
> actually
> writing to the database). I need to make contact with the database.
> My
> obvious question at this point is, what should I be doing differently?
>
> Thank you,
> rdb
>
> --
> View this message in context:
> http://www.nabble.com/Establishing-two-Connections-in-One-Application---One-javax.jms.Connection%2C-the-other--java.sql.Connection-tp15747720p15747720.html
> Sent from the java.net - glassfish users mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>