1 Reply Latest reply on Apr 30, 2008 6:46 AM by amjad277

    Errors in hibernate with Sybase using 4.0.4

    mwelch16

      Hello,

      I am using JBOSS 4.0.4GA, Portal 2.2sp3, and JDK 1.5.0_06 with Sybase 15 and jconnect2.jar (which I believe is 5.5). The hibernate logs in and creates the user tables as expected, but fails when trying to deploy the portal. I have set the PortalDS to run with sybase, but didn't change any settings for the DefaultDS that is configured with the 4.0.4 install. Do I need to set the 4.0.4 application server to run with sybase instead of hsqldb? Here are 4 of the errors in the server.log below. Any insight would be appreciated. I'm sure this is user error.

      Thanks for your help,
      Mark

      Here is the xml in my portal-sybase-ds.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>PortalDS</jndi-name>
       <connection-url>jdbc:sybase:Tds:d8loc:3025/jbossportal</connection-url>
       <driver-class>com.sybase.jdbc2.jdbc.SybDriver</driver-class>
       <user-name>portaladmin</user-name>
       <password>!jboss</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>
       <metadata>
       <type-mapping>Sybase</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      



      Here is my explicit dialect setting in all 4 portal.sar hibernate.cfg.xml files
      <property name="dialect">org.hibernate.dialect.SybaseDialect</property>
      


      Error 1:
      2006-06-30 11:00:23,186 DEBUG [org.jboss.system.ServiceController] starting service jboss.mq:service=PersistenceManager
      2006-06-30 11:00:23,186 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Starting jboss.mq:service=PersistenceManager
      2006-06-30 11:00:23,186 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Creating Schema
      2006-06-30 11:00:23,186 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
      java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]
       at org.hsqldb.jdbc.Util.throwError(Unknown Source)
       at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
       at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
       at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
       at org.jboss.mq.pm.jdbc2.PersistenceManager.createSchema(PersistenceManager.java:259)
       at org.jboss.mq.pm.jdbc2.PersistenceManager.startService(PersistenceManager.java:1563)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      
      Error 2:
      
      2006-06-30 11:00:25,346 DEBUG [org.hibernate.cfg.SettingsFactory] could not get database version from JDBC metadata
      2006-06-30 11:00:25,346 INFO [org.hibernate.cfg.SettingsFactory] RDBMS: Adaptive Server Enterprise, version: Adaptive Server Enterprise/15.0/EBF 13244 ESD#1 ONE-OFF/P/Sun_svr4/OS 5.8/ase150eap/2169/64-bit/FBO/Wed Jan 11 05:02:51 2006
      2006-06-30 11:00:25,346 INFO [org.hibernate.cfg.SettingsFactory] JDBC driver: jConnect (TM) for JDBC (TM), version: jConnect (TM) for JDBC(TM)/5.5(Build 25152)/P/EBF10106/JDK12/Mon Feb 25 19:10:53 2002
      2006-06-30 11:00:25,356 ERROR [org.jboss.portal.cms.hibernate.HibernateStore] failed to initialize file system
      org.hibernate.HibernateException: Hibernate Dialect must be explicitly set for database: Adaptive Server Enterprise
       at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:62)
       at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
       at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:397)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
       at org.jboss.portal.cms.hibernate.HibernateStore.init(HibernateStore.java:251)
       at org.apache.jackrabbit.core.config.FileSystemConfig.init(FileSystemConfig.java:55)
       at org.apache.jackrabbit.core.config.RepositoryConfig.init(RepositoryConfig.java:230)
       at org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryConfig.java:128)
       at org.jboss.portal.cms.impl.jcr.jackrabbit.JackrabbitJCRService.start(JackrabbitJCRService.java:101)
       at org.jboss.portal.cms.impl.jcr.JCRCMS.startJCR(JCRCMS.java:233)
       at org.jboss.portal.cms.impl.jcr.JCRCMS.startService(JCRCMS.java:199)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:196)
       at org.jboss.portal.common.system.AbstractJBossService.start(AbstractJBossService.java:86)
       at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
      
      
      
      Error 3:
      
      2006-06-30 11:00:26,416 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2006-06-30 11:00:26,416 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
      2006-06-30 11:00:26,416 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      2006-06-30 11:00:26,416 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select securitypo0_.PK as PK23_, securitypo0_.REF as REF23_, securitypo0_.PARENTREF as PARENTREF23_ from JBP_SECURITY_POLICY securitypo0_]
      com.sybase.jdbc2.jdbc.SybSQLException: JBP_SECURITY_POLICY not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
      
       at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
       at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
       at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
       at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
       at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
       at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1537)
       at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1522)
       at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:72)
       at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
       at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
       at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
       at org.hibernate.loader.Loader.doQuery(Loader.java:662)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
       at org.hibernate.loader.Loader.doList(Loader.java:2145)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
       at org.hibernate.loader.Loader.list(Loader.java:2024)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.jboss.portal.core.hibernate.SessionFactoryBinder.doCheck(SessionFactoryBinder.java:352)
       at org.jboss.portal.core.hibernate.SessionFactoryBinder.startService(SessionFactoryBinder.java:296)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:196)
       at org.jboss.portal.common.system.AbstractJBossService.start(AbstractJBossService.java:86)
       at org.jboss.portal.core.security.store.HibernateCacheLoader.startService(HibernateCacheLoader.java:88)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:196)
       at org.jboss.portal.common.system.AbstractJBossService.start(AbstractJBossService.java:86)
       at org.jboss.cache.TreeCache.createCacheLoader(TreeCache.java:1320)
       at org.jboss.cache.TreeCache.startService(TreeCache.java:1088)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      
      
      
      Error 4:
      
      com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near the keyword 'ROLE'.
      
       at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
       at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
       at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
       at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
       at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
       at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1537)
       at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1522)
       at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:72)
       at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
       at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
       at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
       at org.hibernate.loader.Loader.doQuery(Loader.java:662)
      
      
      


        • 1. Re: Errors in hibernate with Sybase using 4.0.4

          These messages sometimes causes concern for users. However, most of the time, this message is normal and expected (hence, the DEBUG logging level instead of, say, ERROR or WARN.)

          By default, the server attempts to create the tables that support message persistence. If the tables already exist, a java.sql.SQLException will be thrown. This normally indicates that the tables already exist and do not need to be created. Of course, if the tables do not already exist they will be created, and administrators are not required to create the tables required by JMS as a separate task.

          While the stack trace is usually the feature of the log message that causes concern, it is needed in the DEBUG message. There is no standard SQL exception or message thrown for a "table already exists" type of failure. This means that there is not a general way to report the exception only when the failure is caused by some other problem. Thus, the stack trace is included to facilitate debugging when there is some other failure when creating the tables.

          The automatic creation of the tables can be disabled. Of course, with the feature disabled, the tables must have been created before the Application Server starts for the JMS system to work properly.

          Amjad Farajallah