Jboss3.0.0 and Oracle 8i database connection: Immediately, V
svgkraju Sep 16, 2002 12:23 PMHi,
I have created a CMP entity bean called "Cmp" using JDeveloper 9.0.2. Testing uses a table called "Testing" created in Oracle 8i. The entity bean is using the connection called "Oracle" that is created in the JDeveloper. I have created a client within the JDeveloper and tested it. It is working fine. Now I have to deploy the entity bean to JBoss3.0.0.
In the process of that
1) I copied the classes12.zip JBoss_Home\server\default\lib
2) Added the following code to the login-config.xml file.
<application-policy name = "OracleDbRealm">
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">scott</module-option>
<module-option name = "userName">scott</module-option>
<module-option name = "password">tiger</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
</login-module>
</application-policy>
3) Modified the oracle-xml.xml file to provide the database specific properties. and copied to the Jboss_home\server\default\deploy
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- ==================================================================== -->
<!-- ConnectionManager setup for Oracle dbs -->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- Thanks to Steven Coy -->
<!-- ==================================================================== -->
<!-- Include a login module configuration named OracleDbRealm.
Update your login-conf.xml, here is an example for a
ConfiguredIdentityLoginModule:
<application-policy name = "OracleDbRealm">
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">yourprincipal</module-option>
<module-option name = "userName">yourusername</module-option>
<module-option name = "password">yourpassword</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
</login-module>
</application-policy>
NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
module-option name = "managedConnectionFactoryName"
must match the object name of the ConnectionManager you are configuring here.
-->
<!--uncomment out this line if you are using the OracleDbRealm above
-->
OracleDbRealm
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
OracleDS
<config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@svgk:1521:tools</config-property>
<config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
<!--set these only if you want only default logins, not through JAAS -->
<config-property name="UserName" type="java.lang.String">scott</config-property>
<config-property name="Password" type="java.lang.String">tiger</config-property>
<!--Below here are advanced properties -->
<!--hack-->
<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
<depends optional-attribute-name="ManagedConnectionPool">
<!--embedded mbean-->
0
50
5000
15
<!--criteria indicates if Subject (from security domain) or app supplied
parameters (such as from getConnection(user, pw)) are used to distinguish
connections in the pool. Choices are
ByContainerAndApplication (use both),
ByContainer (use Subject),
ByApplication (use app supplied params only),
ByNothing (all connections are equivalent, usually if adapter supports
reauthentication)-->
ByContainerAndApplication
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager
java:/TransactionManager
<!--make the rar deploy! hack till better deployment-->
jboss.jca:service=RARDeployer
4) Modified the line in standardjbosscmp-jdbc
java:/DefaultDS
to
java:/OracleDS
5) After executing the Jboss
20:47:36,977 INFO [LocalTxConnectionManager] Created
20:47:36,977 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=OracleDS
does not implement any Service methods
20:47:36,977 INFO [LocalTxConnectionManager] Creating
20:47:36,977 INFO [LocalTxConnectionManager] Created
20:47:37,017 INFO [LocalTxConnectionManager] Starting
20:47:38,549 INFO [DefaultDS] Bound connection factory for resource adapter 'JB
oss LocalTransaction JDBC Wrapper' to JNDI name 'java:/DefaultDS'
20:47:38,549 INFO [LocalTxConnectionManager] Started
20:47:38,549 INFO [LocalTxConnectionManager] Starting
20:47:38,569 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.se
curity.plugins.JaasSecurityManager@15e
20:47:38,569 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util
.TimedCachePolicy@15f
20:47:38,569 INFO [JaasSecurityManagerService] Added OracleDbRealm, org.jboss.s
ecurity.plugins.SecurityDomainContext@160 to map
20:47:39,680 INFO [OracleDS] Bound connection factory for resource adapter 'JBo
ss LocalTransaction JDBC Wrapper' to JNDI name 'java:/OracleDS'
20:47:39,680 INFO [LocalTxConnectionManager] Started
20:47:39,680 INFO [MainDeployer] Successfully completed deployment of package:
file:/C:/jboss-3.0.0_tomcat-4.0.3/server/default/deploy/jboss-local-jdbc.rar
20:47:39,680 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss
-3.0.0_tomcat-4.0.3/server/default/deploy/jms-ra.rar
20:47:39,751 WARN [ServiceController] jboss.jca:service=RARDeployment,name=JMS
Adapter does not implement any Service methods
20:47:39,751 WARN [ServiceController] jboss.jca:service=XaTxDS,name=jmsra does
not implement any Service methods
20:47:39,751 INFO [XATxConnectionManager] Creating
20:47:39,751 INFO [XATxConnectionManager] Created
20:47:39,801 INFO [XATxConnectionManager] Starting
20:47:39,821 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.se
curity.plugins.JaasSecurityManager@16a
20:47:39,831 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util
.TimedCachePolicy@16b
20:47:39,831 INFO [JaasSecurityManagerService] Added JmsXARealm, org.jboss.secu
rity.plugins.SecurityDomainContext@16c to map
20:47:41,213 INFO [JmsXA] Bound connection factory for resource adapter 'JMS Ad
apter' to JNDI name 'java:/JmsXA'
20:47:41,213 INFO [XATxConnectionManager] Started
6) Now the actual problem is, When I executed the test client, I got the following error message.
javax.ejb.DuplicateKeyException: Entity with key mypackage1.TestingPK@224 already exists
void sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(java.lang.Exception)
void sun.rmi.transport.StreamRemoteCall.executeCall()
java.lang.Object sun.rmi.server.UnicastRef.invoke(java.rmi.Remote, java.lang.reflect.Method, java.lang.Object[], long)
java.lang.Object org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.invocation.InvokerInterceptor.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.proxy.TransactionInterceptor.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.proxy.SecurityInterceptor.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.proxy.ejb.HomeInterceptor.invoke(org.jboss.invocation.Invocation)
java.lang.Object org.jboss.proxy.ClientContainer.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
mypackage1.Testing $Proxy0.create(long, java.lang.String)
void Samplemypackage1.TestingClient1.main(java.lang.String[])
I didn't understand why the error is coming? Is my oracle jboss connection configuration wrong? Pl. help me in this regard. I am very much need it immediately.