EJB questions are best answered on ejb  mailing list.
To answer your question:
Check your config.xml file and see the
JDBCDataSource tag, and
JDBCConnectionPool tag.
 
see if there names are matching the ones as you specified in the ejb-jar.xml and weblogic-ejb-jar.xml.
 
-----Original Message-----
From: kongtao [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 25, 2002 6:04 PM
To: [EMAIL PROTECTED]
Subject: I can't get the resource reference through <resource-ref> element!

Hi All:
    In my EJB ,I can't get a connection through the  PoolConnection.Follwing is fragment of EntityBean/config.xml/ejb-jar.xml/weblogic-ejb-jar.xml.Pls help me!
your help would be appreciated! In bean codes,The NullPointerException
will be thrown when I invoke the getConnection method.Maybe I can find
the JNDIName of DataSource
.Why?
-------java code--------
env.put(Context.PROVIDER_URL,"t3://localhost:80");
ctx=new InitialContext(env);
ds=(DataSource)ctx.lookup("java:comp/env/jdbc/TXDataSource")
--------config.xml-----
<JDBCConnectionPool
        DriverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
        InitialCapacity="20" LoginDelaySeconds="1"
MaxCapacity="50" naame="TestPool" URL="jdbc:microsoft:sqlserver://192.168.0.246:1433"/>
-------web.xml-----
<resource-ref>
    <description />
    <res-ref-name>jdbc/TXDataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>
-------ejb-jar.xml-----
<entity>
            <resource-ref>
                <description />
                <res-ref-name>jdbc/TXDataSource</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
</entity>
------weblogic-ejb-jar.xml------------
<weblogic-enterprise-bean>
        <ejb-name>StyleBean</ejb-name>
        <reference-descriptor>
            <resource-description>
                <res-ref-name>jdbc/TXDataSource</res-ref-name>
                <jndi-name>MyDataSource</jndi-name>
            </resource-description>
        </reference-descriptor>
        <jndi-name>StyleBean</jndi-name>
</weblogic-enterprise-bean>
------------------------exception fragment
java.lang.NullPointerException
        at com.sabrina.ejb.StyleBean.getConnection(StyleBean.java:341)
        at com.sabrina.ejb.StyleBean.ejbCreate(StyleBean.java:55)
        at =
com.sabrina.ejb.StyleBean_81hvkv_Impl.ejbCreate(StyleBean_81hvkv_Impl
..............

Reply via email to