-
1. Re: CMP Bean and database
pvamstel Jul 23, 2003 11:27 PM (in response to olof)The first step is to declare the database as a service.
This is done by adding a service file in the dploy folder. Examples of service files can be found in the folder docs\examples\jca.
Open an file and is should be simple enough to change the entries to your needs.
Do not forget to add the jdbc driver in the lib folder of your jboss.
After that it is just to reference that datasource in the cmp deployment descriptor.'
grt patrick -
2. Re: CMP Bean and database
olof Jul 24, 2003 7:32 AM (in response to olof)Ok,
I have modified the 'oracle-xa-ds.xml' file and put it on my deploy folder with the name 'oracle-service.xml'.
I hove copied the classe12.zip in my lib folder.
In JNDIView, I can see the jndi-name which is in my 'oracle-service.xml'.
But now I'm confused. I would like to find examples to create my entity bean and my deployment descriptor...
Thank you ! -
3. Re: CMP Bean and database
pvamstel Jul 25, 2003 12:22 AM (in response to olof)Ok
You are half way there.
Now a cmp example.
This is the jbosscmp-jdbc.xml. This file has a datasource entry. This should be the name in your jndi view. Furthermore you need your ejb-jar.xml. But in that file there is no reference to the datasource.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
<jbosscmp-jdbc>
${datasource.name}
<datasource-mapping>${datasource.mapping}</datasource-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<pk-constraint>true</pk-constraint>
<fk-constraint>true</fk-constraint>
<enterprise-beans>
<ejb-name>anachron_PublisherEntity</ejb-name>
<table-name>an_Publisher</table-name>
<cmp-field>
<field-name>publisherId</field-name>
<column-name>publisherId</column-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>name</column-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
<column-name>description</column-name>
</cmp-field>
<cmp-field>
<field-name>creationTime</field-name>
<column-name>creationTime</column-name>
</cmp-field>
<cmp-field>
<field-name>lastModified</field-name>
<column-name>lastModified</column-name>
</cmp-field>
</jbosscmp-jdbc> -
4. Re: CMP Bean and database
olof Jul 31, 2003 2:49 AM (in response to olof)Thank you pvamstel !
Here is that I do :
- copy %JBOSS_DIST%/docs/examples/jca/oracle-xa-ds.xml in %JBOSS_DIST%/server/default/deploy/
- modify this file (url, user, password)
- my JNDI name is : java:/OracleDS
- Copy classes12.zip in %JBOSS_DIST%/server/default/lib/
- in transaction-service.xml, uncomment True...
- create the jbosscmp-jdbc.xml (see attachment - no, I can't attach file !!! If need, I while paste it on my next post)
When I run JBoss, I have this error :
10:31:55,056 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean ope
ration 'checkIncompleteDeployments()'
Cause: Incomplete Deployment listing:
Packages waiting for a deployer:
[org.jboss.deployment.DeploymentInfo@20e9f4c0 { url=file:/C:/java/jboss-3.2.1/se
rver/default/deploy/jbosscmp-jdbc.xml }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/C:/java/jboss-3.2.1/server/default/deploy/jbosscmp-jdbc.xml
lastDeployed: 1059640308807
lastModified: 1059640308807
mbeans:
]Incompletely deployed packages:
[org.jboss.deployment.DeploymentInfo@20e9f4c0 { url=file:/C:/java/jboss-3.2.1/se
rver/default/deploy/jbosscmp-jdbc.xml }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/C:/java/jboss-3.2.1/server/default/deploy/jbosscmp-jdbc.xml
lastDeployed: 1059640308807
lastModified: 1059640308807
mbeans:
]MBeans waiting for classes:
MBeans waiting for other MBeans:
10:31:55,135 INFO [URLDeploymentScanner] Started
10:31:55,166 INFO [MainDeployer] Deployed package: file:/C:/java/jboss-3.2.1/se
rver/default/conf/jboss-service.xml
10:31:55,181 INFO [Server] JBoss (MX MicroKernel) [3.2.1 (build: CVSTag=JBoss_3
_2_1 date=200305041533)] Started in 19s:624ms
Any idea ???
Thank you !