Announcement Announcement Module
Collapse
No announcement yet.
Problem regarding mysql 4.1.21-standard + hibernate 3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem regarding mysql 4.1.21-standard + hibernate 3

    Hi,
    i have updated my data base version mysql 4.0 to mysql 4.1.21-standard. It gave me the follwoing exception:

    WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
    2006-09-26 14:42:57,412 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsException message given: 26)
    2006-09-26 14:42:57,412 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
    org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsException message given: 26)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:855)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:540)
    at org.springframework.orm.hibernate3.LocalDataSource ConnectionProvider.getConnection(LocalDataSourceCo nnectionProvider.java:80)
    at org.hibernate.cfg.SettingsFactory.buildSettings(Se ttingsFactory.java:72)
    at org.hibernate.cfg.Configuration.buildSettings(Conf iguration.java:1815)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1143)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.newSessionFactory(LocalSessionFactoryBean .java:777)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.afterPropertiesSet(LocalSessionFactoryBea n.java:703)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1003)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:348)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:269)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:230)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:156)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 48)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3659)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4097)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1012)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1012)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:450)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:409)
    Caused by: java.sql.SQLException: Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsException message given: 26
    at com.mysql.jdbc.Connection.execSQL(Connection.java: 2008)
    at com.mysql.jdbc.Connection.execSQL(Connection.java: 1918)
    at com.mysql.jdbc.Statement.executeQuery(Statement.ja va:1188)
    at com.mysql.jdbc.Connection.connectionInit(Connectio n.java:1098)
    at com.mysql.jdbc.Driver.connect(Driver.java:313)
    at org.apache.commons.dbcp.DriverConnectionFactory.cr eateConnection(DriverConnectionFactory.java:37)
    at org.apache.commons.dbcp.PoolableConnectionFactory. makeObject(PoolableConnectionFactory.java:290)
    at org.apache.commons.dbcp.BasicDataSource.validateCo nnectionFactory(BasicDataSource.java:877)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:851)
    ... 32 more


    following is the hibernate properties:

    Code:
    <bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql://localhost:3306/vopium</value>
    		</property>
    		<property name="username">
    			<value>root</value>
    		</property>
    		
    
    	</bean>
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="hibernateProperties">
    			<ref bean="portalHibernateProperties" />
    		</property>
    		<property name="annotatedClasses">
    			<list>
    				
    					<value>com.vopium.portal.businessmodels.CellBrandModel</value>
    								</list>
    		</property>
    	
    	</bean>
    	
       	 	
    	<bean id="portalHibernateProperties"
    		class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    		<property name="properties">
    			<props>
    				<prop key="mapping">
    
    				</prop>
    				
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.MySQLDialect
    				</prop>
    				
    				<prop key="hibernate.query.substitutions">
    					true 'T', false 'F'
    				</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.c3p0.minPoolSize">5</prop>
    				<prop key="hibernate.c3p0.maxPoolSize">20</prop>
    				<prop key="hibernate.c3p0.timeout">600</prop>
    				<prop key="hibernate.c3p0.max_statement">50</prop>
    				<prop key="hibernate.c3p0.testConnectionOnCheckout">
    					false
    				</prop>
    			</props>
    		</property>
    	</bean>


    anyone help?


    Regards,
    shahzad

  • #2
    It's likely that the database upgrade requires either a jdbc update or other datasource settings.
    As a side note, use MySQLInnoDB dialect with Hibernate and remove the hibernate.c3p0 parameters - they are used by Hibernate to create an internal datasource which you don't need since you are passing the setting that through the datasource property.

    Comment


    • #3
      Still not solved

      Hi,
      i have changed Dialect class to

      <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLInnoDB
      </prop>

      and

      Code:
      <bean id="dataSource"
      		class="org.apache.commons.dbcp.BasicDataSource">
      		<property name="driverClassName">
      			<value>com.mysql.jdbc.Driver</value>
      		</property>
      		<property name="url">
      			<value>jdbc:mysql://localhost:3306/vopium</value>
      		</property>
      		<property name="username">
      			<value>root</value>
      		</property>
      		<property name="password">
      			<value>abc</value>
      		</property>
      		<property name="initialSize">
      			<value>30</value>
      		</property>
      		<property name="maxActive">
      			<value>100</value>
      		</property>
      		<property name="maxIdle">
      			<value>30</value>
      		</property>
      		<property name="maxWait">
      			<value>10000</value>
      		</property>
      	</bean>

      i am using mysql-connector-java-5.0.3-bin.jar.
      but sitll could not found solution.

      Regards,
      Shahzad

      Comment


      • #4
        You are using mysql connector 5.x with a 4.1 database - AFAIK, they are incompatible - check out the mysql site for more information. I think with 4.1.x you should use 3.1.3 jdbc driver.

        Comment


        • #5
          Same problem

          Hi,
          I have updated the Connector with "mysql-connector-java-3.1.13-bin.jar".But problem could not solved.

          Regards,
          shahzad

          Comment


          • #6
            See this answer. Basically you have to double check your configuration since, as it seems, some of your settings are wrong.

            Comment


            • #7
              Not solved till now

              Hi,

              I have done all things verified.My MySQL Front client connects successfully.But from application, it gives same following error:


              Code:
               SQL Error: 0, SQLState: null
              2006-09-28 15:48:30,219 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsException message given: 35)
              2006-09-28 15:48:30,249 [main] WARN  org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
              org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsException message given: 35)
              	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
              	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
              	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
              	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
              	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
              	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
              when i connect to the MySQl 4.0.24, It works f9.


              Regards,
              shahzad

              Comment


              • #8
                You can try c3p0 for a change. Also make sure that mysql indeed opens a tcp connection (on a local machine sockets can be used).
                I recommend you try the mysql lists since, as you pointed out, the configuration works with the previous mysql version so it's likely this is a mysql configuration specific problem.

                Comment

                Working...
                X