|
HI,
when u use a reference, in the ejb-xml.jar you declare the
reference,,
and in
the weblogic-ejb.xml you delcare the JNDI name of teh
reference.
then,
in your EJB you lookup the reference as java:/comp/env
the
JNDI name of the resource should be the one declared in your
config.xml
br
marco
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" change to name
and see 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
fragmentjava.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..............
|