Hi there,
I', trying now for hours and days to get this done. Perhaps somebody
could help me out of my trouble. I am using JBoss 2.2.0 FINAL and a
Oracle 8.1.7 DataSource. When I try to lookup the DataSource within my
Bean (BMP Entity Bean) I get the following Exception:
[Account] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
javax.ejb.EJBException
[Account] java.lang.ClassCastException: java.lang.OutOfMemoryError
[Account] at
org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:488)
[Account] at
org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:211)
[Account] at
org.jboss.ejb.EntityContainer.find(EntityContainer.java:419)
[Account] at java.lang.reflect.Method.invoke(Native Method)
[Account] at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:639)
[Account] at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:160)
[Account] at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:87)
[Account] at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
[Account] at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)
[Account] at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
[Account] at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:164)
[Account] at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
[Account] at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316)
[Account] at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:369)
[Account] at java.lang.reflect.Method.invoke(Native Method)
[Account] at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
[Account] at sun.rmi.transport.Transport$1.run(Transport.java:152)
[Account] at java.security.AccessController.doPrivileged(Native Method)
[Account] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
[Account] at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
[Account] at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
[Account] at java.lang.Thread.run(Thread.java:484)
The code I am using within my bean to lookup the DataSource is the
following:
private Connection getConnection()
throws SQLException
{
InitialContext ctx = null;
try {
ctx = new InitialContext();
DataSource ds = (javax.sql.DataSource)
ctx.lookup("java:/comp/env/jdbc/MyPool");
return ds.getConnection();
} catch (NamingException ne) {
throw new SQLException(ne.getMessage());
}
}
My jboss.jcml looks like this:
[...]
<!-- JDBC -->
<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
<attribute name="Drivers">oracle.jdbc.driver.OracleDriver</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=comp/env/jdbc/MyPool">
<attribute name="PoolName">comp/env/jdbc/MyPool</attribute>
<attribute
name="DataSourceClass">oracle.jdbc.xa.client.OracleXADataSource</attribute>
<attribute
name="URL">jdbc:oracle:thin:@myhost:1521:instance</attribute>
<attribute name="JDBCUser">user</attribute>
<attribute name="Password">pass</attribute>
</mbean>
[...]
And here I have my ejb-jar.xml and my jboss.xml:
<ejb-jar>
<enterprise-beans>
<entity>
<display-name>Account</display-name>
<ejb-name>Account</ejb-name>
<home>mycomponent.ejb.AccountHome</home>
<remote>mycomponent.ejb.Account</remote>
<ejb-class>mycomponent.ejb.AccountBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>mycomponent.ejb.AccountPK</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/MyPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
</ejb-jar>
<jboss>
<enterprise-beans>
<entity>
<ejb-name>Account</ejb-name>
<jndi-name>Account</jndi-name>
</entity>
</enterprise-beans>
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>jdbc/MyPool</res-name>
<res-jndi-name>java:/comp/env/jdbc/MyPool</res-jndi-name>
</resource-manager>
</resource-managers>
</jboss>
And when the Server starts, everthing seems to be ok (at least in my
eyes):
[JDBC provider] Initializing
[JDBC provider] Loaded JDBC-driver:oracle.jdbc.driver.OracleDriver
[JDBC provider] Initialized
[comp/env/jdbc/MyPool] Initializing
[comp/env/jdbc/MyPool] Initialized
[...]
[JDBC provider] Starting
[JDBC provider] Started
[comp/env/jdbc/MyPool] Starting
[comp/env/jdbc/MyPool] XA Connection pool comp/env/jdbc/MyPool bound to
java:/comp/env/jdbc/MyPool
[comp/env/jdbc/MyPool] Started
So what do I miss????
Any help or ideas for me?
Thanks in advance!
Ralf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user