This code works in both jBoss and WebLogic.  We had to extract the pool name
because WebLogic does not use java:/usswebPool like jBoss does.  It just
uses just usswebPool ( Damn them ).

        Connection getConnection() {

        Connection conn = null;

        try {
                ussweb.system.System sys = new ussweb.system.System();
                Context initCtx = new InitialContext();
                javax.sql.DataSource ds =
(javax.sql.DataSource)initCtx.lookup(sys.getJNDIPoolName());
                conn = ds.getConnection();
        }
        catch( NamingException n ) {
                n.printStackTrace();
        }
        catch( Exception e ) {
                e.printStackTrace();
        }

        return conn;
        }

The following bit of code does not work and throws a ClassNotFoundException:

        Connection getConnection() {

        Connection conn = null;

        try {
                Class.forName( "org.jboss.minerva.datasource.PoolDriver");
                conn = DriverManager.getConnection(
"jdbc:minerva:usswebPool" );
        }
        catch( Exception e ) {
                e.printStackTrace();
        }

        return conn;
        }

It never makes it to the driver manager code.  The exception thrown is as
follows:

[Pin] New Pin Entity Bean Java Object created by EJB Container.
[Pin] setEntityContext
[Pin] ejbFindByBarcode 150238415
[Pin] java.lang.ClassNotFoundException:
org.jboss.minerva.datasource.PoolDriver
[Pin]   at java.net.URLClassLoader$1.run(Unknown Source)
[Pin]   at java.security.AccessController.doPrivileged(Native Method)
[Pin]   at java.net.URLClassLoader.findClass(Unknown Source)
[Pin]   at java.lang.ClassLoader.loadClass(Unknown Source)
[Pin]   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[Pin]   at java.lang.ClassLoader.loadClass(Unknown Source)
[Pin]   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[Pin]   at java.lang.Class.forName0(Native Method)
[Pin]   at java.lang.Class.forName(Unknown Source)
[Pin]   at ussweb.dbPin.PinBean.getConnection(PinBean.java:459)
[Pin]   at ussweb.dbPin.PinBean.verifyCard(PinBean.java:436)
[Pin]   at ussweb.dbPin.PinBean.ejbFindByBarcode(PinBean.java:407)
[Pin]   at java.lang.reflect.Method.invoke(Native Method)
[Pin]   at
org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceM
anager.java:410)
[Pin]   at
org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager
.java:195)
[Pin]   at org.jboss.ejb.EntityContainer.find(EntityContainer.java:411)
[Pin]   at java.lang.reflect.Method.invoke(Native Method)
[Pin]   at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContaine
r.java:591)
[Pin]   at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySync
hronizationInterceptor.java:160)
[Pin]   at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInt
erceptor.java:86)
[Pin]   at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
[Pin]   at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
java:226)
[Pin]   at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
[Pin]   at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
a:126)
[Pin]   at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
[Pin]   at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:315)
[Pin]   at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
nerInvoker.java:143)
[Pin]   at java.lang.reflect.Method.invoke(Native Method)
[Pin]   at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
[Pin]   at sun.rmi.transport.Transport$1.run(Unknown Source)
[Pin]   at java.security.AccessController.doPrivileged(Native Method)
[Pin]   at sun.rmi.transport.Transport.serviceCall(Unknown Source)
[Pin]   at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
[Pin]   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Source)
[Pin]   at java.lang.Thread.run(Unknown Source)

-----Original Message-----
From: Aaron Mulder [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 15, 2000 1:59 PM
To: jBoss
Subject: RE: [jBoss-User] Minerva Question


        Okay, so far, so good.  All the pools loaded successfully.  Can
you now include the code you're using to open connections which is
failing, and the exception stack trace that is generated?  Also, I really
thought WebLogic supported JNDI DataSources.  Is that not true?

Aaron

On Wed, 15 Nov 2000, Wes Mckean wrote:
> I'm sorry Aaron.  I'm not trying to be difficult.  I really don't think
this
> is a Minerva question anymore at all.  I think this is a CLASSPATH issue
> that I don't understand.  If I put my JAR file in the lib/ext directory,
and
> it loads properly, and I see the JDCB Mbean load the JDBC drivers
correctly,
> which I have set up in the jboss.properties file, then why can't I do a
> Class.forName on my class?
>
>       Class.forName( "com.inet.tds.TdsDriver");
>       Class.forName( "org.jboss.minerva.datasource.PoolDriver");
>
> Both of these throw a ClassNotFoundException in my EJB.  At this point, I
> could care less about connection pool.  I have that working now, although
I
> can't use the PoolDriver for the reason stated above.  My main wish for
> using the PoolDriver was so that I could keep my code compatible between
> jBoss and Darth WebLogic.  Inserted below is the Debug output from my
jBoss
> startup.
>
> You will see that the JDBC driver is loaded properly from the Una2000.jar
> file.
> ...



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to