2 Replies Latest reply on Jun 14, 2005 9:32 AM by Rick Price

    Hibernate Failing

    Rick Price Newbie

      Jboss 4.0.2
      Portal RC3
      MySQL JConnector 3.1.8 (com.mysql.jdbc.driver)

      My MySQL seems to be doing alright now but Hibernate is failing. Here is what I get when I first see Hibernate startup.


      class org.jboss.cache.interceptors.UnlockInterceptor
      10:05:14,827 INFO [TreeImpl$FixedTreeCache] cache mode is local, will not create the channel
      10:05:14,921 INFO [Environment] Hibernate 3.0.2
      10:05:14,936 INFO [Environment] hibernate.properties not found
      10:05:14,936 INFO [Environment] using CGLIB reflection optimizer
      10:05:14,936 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
      10:05:15,046 INFO [Configuration] configuring from url: file:/C:/jboss-4.0.2/server/default/deploy/jboss-portal.sar/conf/hibernate/hibernate.cfg.xml
      10:05:15,061 INFO [Configuration] Mapping resource: org/jboss/portal/core/impl/role/RoleImpl.hbm.xml

      Here is what I see for MySQL:


      10:05:15,405 INFO [NamingHelper] JNDI InitialContext properties:{}
      10:05:15,405 INFO [DatasourceConnectionProvider] Using datasource: java:PortalDS
      10:05:15,483 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: --> NonRegisteringDriver.java:223 com.mysql.jdbc.NonRegisteringDriver.acceptsURL("jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false")
      10:05:15,483 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: --> NonRegisteringDriver.java:339 com.mysql.jdbc.NonRegisteringDriver.parseURL("jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false", null)
      10:05:15,499 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: --> StringUtils.java:722 com.mysql.jdbc.StringUtils.startsWithIgnoreCase("jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false", "jdbc:mysql://")
      10:05:15,499 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: --> StringUtils.java:738 com.mysql.jdbc.StringUtils.startsWithIgnoreCase("jdbc:mysql://local
      host:3306/jbossportal?useServerPrepStmts=false", 0, "jdbc:mysql://")
      10:05:15,499 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: <-- StringUtils.java:738 com.mysql.jdbc.StringUtils.startsWithIgnoreCase(..) returning true
      10:05:15,499 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: <-- StringUtils.java:722 com.mysql.jdbc.StringUtils.startsWithIgnoreCase(..) returning true
      10:05:15,499 INFO [STDOUT] Mon Jun 13 10:05:15 EDT 2005 TRACE: <-- NonRegisteringDriver.java:339 com.mysql.jdbc.NonRegisteringDriver.parseURL(..) returning {HOST=localhost:3306, DBNAME=jbossportal, useServerPrepStmts=false}

      Many more INFO lines follow this.


      10:05:21,311 INFO [STDOUT] Mon Jun 13 10:05:21 EDT 2005 TRACE: <-- ResultSet.java:7079 com.mysql.jdbc.ResultSet.finalize(..) returning null
      10:05:21,311 INFO [SettingsFactory] RDBMS: MySQL, version: 4.1.12a-nt
      10:05:21,311 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.8 ( $Date: 2005/04/14 20:36:13 $, $Revision: 1.27.4.64 $ )
      10:05:21,374 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
      10:05:21,374 INFO [SettingsFactory] JDBC batch size: 15
      10:05:21,374 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
      10:05:21,374 INFO [SettingsFactory] Scrollable result sets: enabled
      10:05:21,374 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
      10:05:21,374 INFO [SettingsFactory] Aggressive release : disabled
      10:05:21,374 INFO [SettingsFactory] Maximum outer join fetch depth: 2
      10:05:21,374 INFO [SettingsFactory] Default batch fetch size: 1
      10:05:21,374 INFO [SettingsFactory] Generate SQL with comments: disabled
      10:05:21,374 INFO [SettingsFactory] Order SQL updates by primary key: disabled
      10:05:21,374 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
      10:05:21,390 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
      10:05:21,390 INFO [SettingsFactory] Query language substitutions: {}
      10:05:21,390 INFO [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
      10:05:21,405 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup


      Here's the error I get:


      10:05:22,358 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:portal/SessionFactory
      10:05:22,358 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
      10:05:22,358 INFO [NamingHelper] JNDI InitialContext properties:{}
      10:05:22,358 INFO [SessionFactoryImpl] Checking 0 named queries
      10:05:22,358 INFO [SessionFactoryBinder] Hibernate dialect used org.hibernate.dialect.MySQLDialect
      10:05:22,780 ERROR [SessionFactoryBinder] Starting failed portal:service=Hibernate java.lang.NullPointerException
      at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:1845)
      at com.mysql.jdbc.PreparedStatement.toString(PreparedStatement.java:1770
      )
      at java.lang.String.valueOf(String.java:2577)
      at java.lang.StringBuffer.append(StringBuffer.java:220)
      at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
      at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
      at com.mysql.jdbc.trace.Tracer.entry(Tracer.aj:126)
      at com.mysql.jdbc.trace.Tracer.ajc$before$com_mysql_jdbc_trace_Tracer$1$
      f51c62b8(Tracer.aj:45)
      at com.mysql.jdbc.Connection.registerStatement(Connection.java)
      at com.mysql.jdbc.Statement.(Statement.java:171)
      at com.mysql.jdbc.PreparedStatement.(PreparedStatement.java:139)
      at com.mysql.jdbc.Connection.clientPrepareStatement(Connection.java:1053
      )

      ..........

      10:05:23,280 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/jmx-console.war/
      10:05:23,374 INFO [STDOUT] Mon Jun 13 10:05:23 EDT 2005 TRACE: --> Statement.java:1627 com.mysql.jdbc.Statement.finalize()
      10:05:23,374 INFO [STDOUT] Mon Jun 13 10:05:23 EDT 2005 TRACE: --> PreparedStatement.java:2087 com.mysql.jdbc.PreparedStatement.realClose(false)
      10:05:23,374 INFO [STDOUT] Mon Jun 13 10:05:23 EDT 2005 TRACE: --> Statement.java:1576 com.mysql.jdbc.Statement.realClose(false)
      10:05:23,468 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

      --- MBeans waiting for other MBeans ---
      ObjectName: portal:service=Hibernate
      State: FAILED
      Reason: java.lang.NullPointerException
      I Depend On:
      jboss.jca:service=DataSourceBinding,name=PortalDS
      Depends On Me:
      portal:service=Module,type=User
      portal:service=Module,type=Role
      portal:service=Module,type=Security
      portal:service=ServerManager

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: portal:service=Hibernate
      State: FAILED
      Reason: java.lang.NullPointerException
      I Depend On:
      jboss.jca:service=DataSourceBinding,name=PortalDS
      Depends On Me:
      portal:service=Module,type=User
      portal:service=Module,type=Role
      portal:service=Module,type=Security
      portal:service=ServerManager


      10:05:23,655 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
      10:05:23,780 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
      10:05:23,796 INFO [JkMain] Jk running ID=0 time=0/47 config=null
      10:05:23,827 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 30s:937ms

      The database exists in MySQL and the user has full access to the database. It is empty since the docs say the portal will build it automatically and I don't need to run a script first. Being new to Hibernate and the portal, this problem is eating my lunch! Any help would be greatly appreciated.

        • 1. Re: Hibernate Failing
          Roy Russo Master

          What version of MySQL Server are you running?

          I have not seen this error before, but I also haven't tried using the 3.18a driver. I'm using 3.0.16:

          <?xml version="1.0" encoding="UTF-8"?>
          <datasources>
           <local-tx-datasource>
           <jndi-name>PortalDS</jndi-name>
           <connection-url>jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false</connection-url>
           <driver-class>org.gjt.mm.mysql.Driver</driver-class>
           <user-name>root</user-name>
           <password></password>
           </local-tx-datasource>
          </datasources>
          


          • 2. Re: Hibernate Failing
            Rick Price Newbie

            I have MySQL 4.1.12a. I'm not sure that this is where the problem is since I tried removing the Protal sar file and starting everything up. I can start the server and when I go to the JMX console page, I can see the datasource. So the datasource seems to be getting created OK. I'm just not experienced enough with Hibernate to figure out what the problem is there.

            I'm pulling what little hair I have left out with this one!

            Rick Price