2 Replies Latest reply on Nov 29, 2007 3:08 AM by jebberwocky

    EJB Deploynment with JBoss and use of annotations fails

    aneta

      I followed the instuctions on the EJB3-Tutotial on the site http://www.laliluna.de/download/firs...utorial-en.pdf
      but I can't deploy the application right, as the error down shows.
      I use mysql-ds.xml in the deploy-directory in JBOSS and mysql Server 4.1 and in jboss and I placed the mysql Connector mysql-connector-java-5.0.6-bin.jar in the directory
      $JBOSS_HOME/server/default/deploy/lib as said in this tutorial. I don't understand what the error-reason is. Has anybody an idea?Thanks.

      My mysql-ds.xml -file looks like this:

      <?xml version="1.0" encoding="UTF-8"?>

      <local-tx-datasource>
      <jndi-name>ejb3ExampleDS</jndi-name>
      <connection-url>jdbc:mysql://mysql-hostname:3306/examples</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>x</user-name>
      y <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>

      <type-mapping>mySQL</type-mapping>

      </local-tx-datasource>



      The JBoss Error Stack:
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: persistence.units:jar=FirstEJB3Tutorial.jar,unitName=FirstEjb3Tutori
      al
      State: FAILED
      Reason: javax.persistence.PersistenceException: org.hibernate.HibernateExcepti
      on: Hibernate Dialect must be explicitly set
      I Depend On:
      jboss.jca:service=DataSourceBinding,name=ejb3ExampleDS
      Depends On Me:
      jboss.j2ee:jar=FirstEJB3Tutorial.jar,name=BookTestBean,service=EJB3

        • 1. Re: EJB Deploynment with JBoss and use of annotations fails
          aneta

          Hello,

          ths is ok as I specified the hibernate-dialect correctly. Jboss deployed the application and I have a table "book" in my mysql. Now I still can enter or manipulate data.

          This is my JBoss-Stacktrace:
          16:22:53,535 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
          -8080
          16:22:53,691 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
          16:22:53,707 INFO [JkMain] Jk running ID=0 time=0/47 config=null
          16:22:53,785 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
          ch_4_0 date=200610162339)] Started in 35s:531ms
          16:23:04,379 INFO [Ejb3Deployment] EJB3 deployment time took: 656
          16:23:04,379 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ja
          r=FirstEJB3Tutorial.jar,unitName=FirstEjb3Tutorial with dependencies:
          16:23:04,379 INFO [JmxKernelAbstraction] jboss.jca:name=ejb3ExampleDS,ser
          vice=DataSourceBinding
          16:23:04,441 INFO [Version] Hibernate EntityManager 3.2.0.CR2
          16:23:04,457 INFO [Version] Hibernate Annotations 3.2.0.CR2
          16:23:04,473 INFO [Environment] Hibernate 3.2.0.ga
          16:23:04,488 INFO [Environment] hibernate.properties not found
          16:23:04,488 INFO [Environment] Bytecode provider name : javassist
          16:23:04,488 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
          16:23:04,660 INFO [Ejb3Configuration] found EJB3 Entity bean: de.laliluna.libra
          ry.Book
          16:23:04,660 WARN [Ejb3Configuration] Persistence provider caller does not impl
          ements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is n
          ull.
          16:23:04,754 INFO [Configuration] Reading mappings from resource: META-INF/orm.
          xml
          16:23:04,769 INFO [Ejb3Configuration] [PersistenceUnit: FirstEjb3Tutorial] no M
          ETA-INF/orm.xml found
          16:23:04,848 INFO [AnnotationBinder] Binding entity from annotated class: de.la
          liluna.library.Book
          16:23:04,926 INFO [EntityBinder] Bind entity de.laliluna.library.Book on table
          book
          16:23:05,191 INFO [ConnectionProviderFactory] Initializing connection provider:
          org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
          16:23:05,207 INFO [InjectedDataSourceConnectionProvider] Using provided datasou
          rce
          16:23:05,519 INFO [SettingsFactory] RDBMS: MySQL, version: 4.1.18-nt
          16:23:05,519 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version:
          mysql-connector-java-5.0.6 ( $Date: 2007-03-09 22:13:57 +0100 (Fri, 09 Mar 2007
          ) $, $Revision: 6341 $ )
          16:23:05,551 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
          16:23:05,551 INFO [TransactionFactoryFactory] Transaction strategy: org.hiberna
          te.ejb.transaction.JoinableCMTTransactionFactory
          16:23:05,551 INFO [TransactionManagerLookupFactory] instantiating TransactionMa
          nagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
          16:23:05,566 INFO [TransactionManagerLookupFactory] instantiated TransactionMan
          agerLookup
          16:23:05,566 INFO [SettingsFactory] Automatic flush during beforeCompletion():
          disabled
          16:23:05,566 INFO [SettingsFactory] Automatic session close at end of transacti
          on: disabled
          16:23:05,566 INFO [SettingsFactory] JDBC batch size: 15
          16:23:05,566 INFO [SettingsFactory] JDBC batch updates for versioned data: disa
          bled
          16:23:05,566 INFO [SettingsFactory] Scrollable result sets: enabled
          16:23:05,566 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
          16:23:05,566 INFO [SettingsFactory] Connection release mode: auto
          16:23:05,566 INFO [SettingsFactory] Maximum outer join fetch depth: 2
          16:23:05,566 INFO [SettingsFactory] Default batch fetch size: 1
          16:23:05,566 INFO [SettingsFactory] Generate SQL with comments: disabled
          16:23:05,566 INFO [SettingsFactory] Order SQL updates by primary key: disabled
          16:23:05,566 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.AST
          QueryTranslatorFactory
          16:23:05,566 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
          16:23:05,566 INFO [SettingsFactory] Query language substitutions: {}
          16:23:05,566 INFO [SettingsFactory] JPA-QL strict compliance: enabled
          16:23:05,566 INFO [SettingsFactory] Second-level cache: enabled
          16:23:05,566 INFO [SettingsFactory] Query cache: disabled
          16:23:05,566 INFO [SettingsFactory] Cache provider: org.hibernate.cache.Hashtab
          leCacheProvider
          16:23:05,582 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
          16:23:05,582 INFO [SettingsFactory] Structured second-level cache entries: disa
          bled
          16:23:05,582 INFO [SettingsFactory] Statistics: disabled
          16:23:05,582 INFO [SettingsFactory] Deleted entity synthetic identifier rollbac
          k: disabled
          16:23:05,582 INFO [SettingsFactory] Default entity-mode: pojo
          16:23:05,644 INFO [SessionFactoryImpl] building session factory
          16:23:06,332 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no
          JNDI name configured
          16:23:06,348 INFO [SchemaExport] Running hbm2ddl schema export
          16:23:06,348 INFO [SchemaExport] exporting generated schema to database
          16:23:06,379 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
          16:23:06,379 WARN [JDBCExceptionReporter] Unknown table 'book'
          16:23:06,441 WARN [JDBCExceptionReporter] SQL Warning: 1051, SQLState: 42S02
          16:23:06,441 WARN [JDBCExceptionReporter] Unknown table 'book'

          16:23:06,441 INFO [SchemaExport] schema export complete
          16:23:06,473 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.fa
          ctory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.p
          kgs=org.jboss.naming:org.jnp.interfaces}
          16:23:06,535 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=First
          EJB3Tutorial.jar,name=BookTestBean,service=EJB3 with dependencies:
          16:23:06,535 INFO [JmxKernelAbstraction] persistence.units:jar=FirstEJB3T
          utorial.jar,unitName=FirstEjb3Tutorial
          16:23:06,941 INFO [EJBContainer] STARTED EJB: de.laliluna.library.BookTestBean
          ejbName: BookTestBean
          16:23:07,051 INFO [EJB3Deployer] Deployed: file:/C:/Programme/JBoss/jboss-4.0.5
          .GA/server/default/deploy/FirstEJB3Tutorial.jar

          Why is book unknown as it exists in mysql?

          • 2. Re: EJB Deploynment with JBoss and use of annotations fails
            jebberwocky

            From http://www.laliluna.de/ejb-3-tutorial-jboss.html

            JBoss supports the tag hibernate.hbm2ddl.auto to define if your tables are created or udpated during redeployment. I chose create-drop to have them dropped after each undeployment, so that they can be nicely recreated. The option update does not work sometimes.

            When you undeploy (EX:restart JBoss) , the table "book" is dropped. That causes the warning comes out.