2 Replies Latest reply on Mar 31, 2006 12:32 AM by Feroz Ahanger

    how to configure EJB 3 TrailBlazer to use mysql 5

    Feroz Ahanger Newbie

      hi,
      TrailBlazer works fine with default configuration. Now, I want to use mysql ver 5 as a database with it. This is what I did:
      1) Configure MySQL DataSource (mysql-ds.xml)

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- $Id: mysql-ds.xml,v 1.3.2.1 2004/12/01 11:46:00 schrouf Exp $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:
      http://www.mysql.com/downloads/api-jdbc-stable.html
      -->
      
      <datasources>
       <local-tx-datasource>
       <jndi-name>jdbc/mysqlDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/testdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>feroz</user-name>
       <password>feroz</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
       <!-- sql to call on an existing pooled connection when it is obtained from pool
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      2) Change persistence.xml to use mySQL datasource
      <persistence>
       <persistence-unit name="ejb3trail">
       <jta-data-source>java:/mysqlDS</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto"
       value="create-drop"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      Is that all or there is something else that I need to do?

      Errors:
      ===============================================================================
      .
       JBoss Bootstrap Environment
      .
       JBOSS_HOME: D:\jboss-4.0.4RC1\bin\\..
      .
       JAVA: C:\java\bin\java
      .
       JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m
      .
       CLASSPATH: C:\java\lib\tools.jar;D:\jboss-4.0.4RC1\bin\\run.jar
      .
      ===============================================================================
      .
      10:47:35,828 INFO [Server] Starting JBoss (MX MicroKernel)...
      10:47:35,828 INFO [Server] Release ID: JBoss [Zion] 4.0.4RC1 (build: CVSTag=JBo
      ss_4_0_4_RC1 date=200602071519)
      10:47:35,843 INFO [Server] Home Dir: D:\jboss-4.0.4RC1
      10:47:35,843 INFO [Server] Home URL: file:/D:/jboss-4.0.4RC1/
      10:47:35,843 INFO [Server] Patch URL: null
      10:47:35,843 INFO [Server] Server Name: default
      10:47:35,843 INFO [Server] Server Home Dir: D:\jboss-4.0.4RC1\server\default
      10:47:35,843 INFO [Server] Server Home URL: file:/D:/jboss-4.0.4RC1/server/defa
      ult/
      10:47:35,843 INFO [Server] Server Temp Dir: D:\jboss-4.0.4RC1\server\default\tm
      p
      10:47:35,843 INFO [Server] Root Deployment Filename: jboss-service.xml
      10:47:36,125 INFO [ServerInfo] Java version: 1.5.0_06,Sun Microsystems Inc.
      10:47:36,125 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.5.0_06-b05
      ,Sun Microsystems Inc.
      10:47:36,125 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
      10:47:36,500 INFO [Server] Core system initialized
      10:47:37,546 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
      ce:log4j.xml
      10:47:38,968 INFO [SocketServerInvoker] Invoker started for locator: InvokerLoc
      ator [socket://192.168.1.102:3873/]
      10:47:39,250 INFO [AspectDeployer] Deployed AOP: file:/D:/jboss-4.0.4RC1/server
      /default/deploy/ejb3-interceptors-aop.xml
      10:47:40,031 INFO [WebService] Using RMI server codebase: http://feroz-nb:8083/
      
      10:47:40,125 WARN [EJBTimerServiceImpl] Cannot obtain TransactionManager from J
      NDI, using TxManager.getInstance(): javax.naming.NameNotFoundException: Transact
      ionManager not bound
      10:47:41,578 INFO [NamingService] Started jndi bootstrap jnpPort=1099, rmiPort=
      1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server Socket
      Factory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
      10:47:41,640 INFO [EJB3Deployer] Default persistence.properties: {hibernate.tra
      nsaction.flush_before_completion=true, hibernate.cglib.use_reflection_optimizer=
      false, hibernate.transaction.auto_close_session=false, hibernate.jndi.java.namin
      g.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, hibernate.cache.provider
      _class=org.hibernate.cache.HashtableCacheProvider, hibernate.transaction.manager
      _lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, hibernate
      .jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, hiber
      nate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory, hibern
      ate.connection.release_mode=after_statement}
      10:47:42,140 INFO [Embedded] Catalina naming disabled
      10:47:42,468 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0
      .0.0-8080
      10:47:42,468 INFO [Catalina] Initialization processed in 281 ms
      10:47:42,468 INFO [StandardService] Starting service jboss.web
      10:47:42,468 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.5.1
      2
      10:47:42,500 INFO [StandardHost] XML validation disabled
      10:47:42,515 INFO [Catalina] Server startup in 47 ms
      10:47:42,640 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jbosswe
      b-tomcat55.sar/ROOT.war/
      10:47:42,890 INFO [WebappLoader] Dual registration of jndi stream handler: fact
      ory already defined
      10:47:43,312 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-local-jdbc.rar
      10:47:43,359 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-xa-jdbc.rar
      10:47:43,437 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jms/jms-ra.rar
      10:47:43,718 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=ConnectionFactoryBinding,name=jdbc/firebirdDS' to JNDI name 'jav
      a:jdbc/firebirdDS'
      10:47:44,328 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
      10:47:44,562 INFO [A] Bound to JNDI name: queue/A
      10:47:44,562 INFO [B] Bound to JNDI name: queue/B
      10:47:44,562 INFO [C] Bound to JNDI name: queue/C
      10:47:44,562 INFO [D] Bound to JNDI name: queue/D
      10:47:44,578 INFO [ex] Bound to JNDI name: queue/ex
      10:47:44,593 INFO [testTopic] Bound to JNDI name: topic/testTopic
      10:47:44,593 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
      10:47:44,593 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
      
      10:47:44,593 INFO [testQueue] Bound to JNDI name: queue/testQueue
      10:47:44,609 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
      0.0:8093
      10:47:44,656 INFO [DLQ] Bound to JNDI name: queue/DLQ
      10:47:44,765 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      10:47:44,812 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=jdbc/mysqlDS' to JNDI name 'java:jdbc/mys
      qlDS'
      10:47:44,843 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../dep
      loy/jmx-console.war/
      10:47:44,984 INFO [EARDeployer] Init J2EE application: file:/D:/jboss-4.0.4RC1/
      server/default/deploy/EJB3Trail.ear
      10:47:46,312 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=ApptransCalculato
      r, class=trail.apptrans.ApptransCalculator, type=STATEFUL
      10:47:46,328 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=EntityCalculator,
       class=trail.entity.basic.EntityCalculator, type=STATELESS
      10:47:46,343 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=QueryCalculator,
      class=trail.entity.query.QueryCalculator, type=STATELESS
      10:47:46,359 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=UpdateCalculator,
       class=trail.entity.update.UpdateCalculator, type=STATELESS
      10:47:46,375 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=CalculatorMDB, cl
      ass=trail.injection.CalculatorMDB, type=MESSAGE_DRIVEN
      10:47:46,375 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=RecordManagerBean
      , class=trail.injection.RecordManagerBean, type=STATELESS
      10:47:46,390 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=InterceptorCalcul
      ator, class=trail.interceptor.InterceptorCalculator, type=STATEFUL
      10:47:46,406 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=CalculatorMBean,
      class=trail.jmx.CalculatorMBean, type=SERVICE
      10:47:46,421 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=SessionCalculator
      , class=trail.lifecycle.SessionCalculator, type=STATEFUL
      10:47:46,421 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=CalculatorBean, c
      lass=trail.mdb.CalculatorBean, type=MESSAGE_DRIVEN
      10:47:46,437 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=MdpojoCalculator,
       class=trail.mdpojo.MdpojoCalculator, type=CONSUMER
      10:47:46,437 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=SecureCalculator,
       class=trail.security.SecureCalculator, type=STATELESS
      10:47:46,453 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=StatefulCalculato
      r, class=trail.sfsb.StatefulCalculator, type=STATEFUL
      10:47:46,453 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=LocalRemoteCalcul
      ator, class=trail.slsb.LocalRemoteCalculator, type=STATELESS
      10:47:46,484 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=StatelessCalculat
      or, class=trail.slsb.StatelessCalculator, type=STATELESS
      10:47:46,484 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=TransCalculator,
      class=trail.transaction.TransCalculator, type=STATELESS
      10:47:46,500 FATAL [PersistenceXmlLoader] ejb3trail JTA
      10:47:46,500 INFO [Ejb3Deployment] EJB3 deployment time took: 329
      10:47:46,515 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ea
      r=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail with dependencies:
      10:47:46,515 INFO [JmxKernelAbstraction] jboss.jca:name=mysqlDS,service=M
      anagedConnectionFactory
      10:47:46,609 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=ApptransCalculator with dependencies:
      10:47:46,609 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:46,625 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=EntityCalculator with dependencies:
      10:47:46,625 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:46,625 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=QueryCalculator with dependencies:
      10:47:46,625 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:46,625 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=UpdateCalculator with dependencies:
      10:47:46,625 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:46,625 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=CalculatorMDB with dependencies:
      10:47:46,875 WARN [MDB] Could not find the queue destination-jndi-name=queue/in
      jection
      10:47:46,875 WARN [MDB] destination not found: queue/injection reason: javax.na
      ming.NameNotFoundException: injection not bound
      10:47:46,875 WARN [MDB] creating a new temporary destination: queue/injection
      10:47:46,875 INFO [injection] Bound to JNDI name: queue/injection
      10:47:46,953 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=RecordManagerBean with dependencies:
      10:47:47,250 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=InterceptorCalculator with dependencies
      :
      10:47:47,328 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=CalculatorMBean with dependencies:
      10:47:47,390 INFO [STDOUT] Calculator - Creating
      10:47:47,390 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=SessionCalculator with dependencies:
      10:47:47,453 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=CalculatorBean with dependencies:
      10:47:47,484 WARN [MDB] Could not find the queue destination-jndi-name=queue/md
      b
      10:47:47,484 WARN [MDB] destination not found: queue/mdb reason: javax.naming.N
      ameNotFoundException: mdb not bound
      10:47:47,484 WARN [MDB] creating a new temporary destination: queue/mdb
      10:47:47,484 INFO [mdb] Bound to JNDI name: queue/mdb
      10:47:47,500 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=MdpojoCalculator with dependencies:
      10:47:47,515 WARN [ConsumerContainer] Could not find the queue destination-jndi
      -name=queue/mdpojo
      10:47:47,515 WARN [ConsumerContainer] destination not found: queue/mdpojo reaso
      n: javax.naming.NameNotFoundException: mdpojo not bound
      10:47:47,515 WARN [ConsumerContainer] creating a new temporary destination: que
      ue/mdpojo
      10:47:47,515 INFO [mdpojo] Bound to JNDI name: queue/mdpojo
      10:47:47,531 INFO [ConsumerContainer] Producer: trail.mdpojo.Calculator
      10:47:47,562 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=SecureCalculator with dependencies:
      10:47:47,562 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:47,562 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=StatefulCalculator with dependencies:
      10:47:47,609 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=LocalRemoteCalculator with dependencies
      :
      10:47:47,703 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=StatelessCalculator with dependencies:
      10:47:47,718 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
      JB3,ear=EJB3Trail.ear,jar=beans.jar,name=TransCalculator with dependencies:
      10:47:47,718 INFO [JmxKernelAbstraction] persistence.units:ear=EJB3Trail.
      ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      10:47:47,718 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.0.4RC1/server/defau
      lt/tmp/deploy/tmp42759EJB3Trail.ear-contents/beans.jar
      10:47:47,718 INFO [TomcatDeployer] deploy, ctxPath=/EJB3Trail, warUrl=.../tmp/d
      eploy/tmp42759EJB3Trail.ear-contents/web-exp.war/
      10:47:47,812 INFO [EARDeployer] Started J2EE application: file:/D:/jboss-4.0.4R
      C1/server/default/deploy/EJB3Trail.ear
      10:47:47,812 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      
      --- MBeans waiting for other MBeans ---
      ObjectName: persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=e
      jb3trail
       State: NOTYETINSTALLED
       I Depend On:
       jboss.jca:name=mysqlDS,service=ManagedConnectionFactory
       Depends On Me:
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=ApptransCalcula
      tor
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=EntityCalculato
      r
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=QueryCalculator
      
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=UpdateCalculato
      r
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=SecureCalculato
      r
       jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=TransCalculator
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=Apptran
      sCalculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=EntityC
      alculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=QueryCa
      lculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=UpdateC
      alculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=SecureC
      alculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      ObjectName: jboss.j2ee:service=EJB3,ear=EJB3Trail.ear,jar=beans.jar,name=TransCa
      lculator
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.jca:name=mysqlDS,service=ManagedConnectionFactory
       State: NOTYETINSTALLED
       Depends On Me:
       persistence.units:ear=EJB3Trail.ear.ear,jar=beans.jar.jar,unitName=ejb3trail
      
      
      
      10:47:47,843 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
      -8080
      10:47:48,015 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
      10:47:48,031 INFO [JkMain] Jk running ID=0 time=0/47 config=null
      10:47:48,031 INFO [Server] JBoss (MX MicroKernel) [4.0.4RC1 (build: CVSTag=JBos
      s_4_0_4_RC1 date=200602071519)] Started in 12s:188ms
      
      


      please help me to configure this.