Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help me to run a conatimer managed bean with Jboss

 
Jasmine kaur
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody ,
I have made all the ejbs files and using MySql as a database with Jboss4.0.
I downloaded the mysql-connector-java-3.1.7-bin.jar and put into the D:\jboss\server\default\lib folder.

After this I configured the follwing files
like this

1) ejb-jar.xml
<?xml version="1.0"?>

<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>cmp</ejb-name>
<home>EjbHome1</home>
<remote>EjbRemote</remote>

<ejb-class>EjbBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>1.x</cmp-version>
<abstract-schema-name>player</abstract-schema-name>
<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>position</field-name></cmp-field>
<cmp-field><field-name>salary</field-name></cmp-field>
<primkey-field>id</primkey-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<description>My CMP</description>
<method>
<ejb-name>cmp</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

2) jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

<jboss>

<enterprise-beans>

<entity>
<ejb-name>cmp</ejb-name>
<jndi-name>cmp</jndi-name>
</entity>

</enterprise-beans>

<resource-managers>
</resource-managers>

</jboss>


3) Third file is standardjbosscmp-jdbc.xml



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">

<!-- ===================================================================== -->
<!-- -->
<!-- Standard JBossCMP-JDBC Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: standardjbosscmp-jdbc.xml,v 1.73 2004/02/06 15:06:00 loubyansky Exp $ -->

<jbosscmp-jdbc>

<defaults>
<datasource>java:/DefaultDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>

<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<read-time-out>300000</read-time-out>
<row-locking>false</row-locking>
<pk-constraint>true</pk-constraint>
<fk-constraint>false</fk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
<read-ahead>
<strategy>on-load</strategy>
<page-size>1000</page-size>
<eager-load-group>*</eager-load-group>
</read-ahead>
<list-cache-max>1000</list-cache-max>


But my program is not running and at server Iam getting exception.Could you please tell me is am mising something or not .
I also try on http://localhost:8080/jmx-console/HtmlAdaptor and give the namme of the driver also but iam getting this message on the jboss server

com.mysql.jdbc.Driver Information
Not loaded in repository cache


### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@15bdc50{ url=file:/D:/jboss/server/default/tmp/deploy/tmp59879jboss-service.xml ,addedOrder=2}

whivh show server is not able to load driver class.
so please tell me where Iam wrong and what should I configure more.
Thanks in advance.
Jasbir
ejb-jar.xmljboss.xml
 
Heonkoo Lee
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to add the jdbc jar to the JBOSS_CLASSPATH environment variable in run.bat.

SET JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;name_of_the_jdbc_jar

Also, change the jndi-name for your bean in the jboss.xml because it is the same as your ejb-name. And 'cmp' as ejb-name doesn't look so good even if it doesn't cause any problem.

Good luck.
[ October 10, 2005: Message edited by: Heonkoo Lee ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic