Page 1 of 1

ClassLoadingException

Posted: Thu Nov 20, 2014 5:26 am
by Sajith S
Unable to load class : org.hibernate.dialect.MySQL5InnoDBDialect

I got this ClassLoadingException when I try to run start my deployed war file. But I found that this dialect class (org.hibernate.dialect.MySQL5InnoDBDialect) has been included by the hibernate-3.2.7.ga.jar file located at the lib directory.

Please do help me. This is my stack trace..

Code: Select all

[ WARN] 16:10:11 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ WARN] 16:10:56 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyClassTransformer) is not being registered with the persistence unit.
[ WARN] 16:10:56 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.convert.EntityMarkerClassTransformer) is not being registered with the persistence unit.
[ WARN] 16:10:56 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyClassTransformer) is not being registered with the persistence unit.
[ WARN] 16:11:31 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [blSandBoxElements]; using defaults.
[ERROR] 16:11:42 SchemaExport - HHH000389: Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO drop foreign key FK3BFDBD63B5D9C34D
[ERROR] 16:11:42 SchemaExport - Table 'broadleaf.blc_additional_offer_info' doesn't exist
[ERROR] 16:11:42 SchemaExport - HHH000389: Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO drop foreign key FK3BFDBD63D5F3FAF4
[ERROR] 16:11:42 SchemaExport - Table 'broadleaf.blc_additional_offer_info' doesn't exist......
.....
[ERROR] 16:17:53 ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blEntityManagerFactorySecureInfo' defined in resource loaded from byte array: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: blSecurePU] Unable to build EntityManagerFactory.....
.....
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: blSecurePU] Unable to build EntityManagerFactory.....
......
Caused by: org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MySQL5InnoDBDialect ....
......
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.MySQL5InnoDBDialect ].....
.......
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.MySQL5InnoDBDialect

Re: ClassLoadingException

Posted: Thu Nov 20, 2014 12:38 pm
by phillipuniverse
What servlet container are you running on?

Re: ClassLoadingException

Posted: Thu Nov 20, 2014 11:25 pm
by Sajith S
We are using apache-tomcat-6.0.41 as we are trying to host an e-commerce site.

Here I'm enclosing both server.xml and context.xml

context.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <ResourceLink global="jdbc/web" name="jdbc/web" type="javax.sql.DataSource"/>
</Context>


Server.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener"/>
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

  <GlobalNamingResources>
 
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
   
   <Resource auth="Container"
       driverClassName="com.mysql.jdbc.Driver"
       initialSize="5"
       maxActive="120"
       maxIdle="5"
       maxWait="5000"
       name="jdbc/web"
       username="root"
       password="admin123"
       poolPreparedStatements="true"
       type="javax.sql.DataSource"
       url="jdbc:mysql://localhost:3306/broadleaf"
       validationQuery="select 1"/>
  </GlobalNamingResources>


  <Service name="Catalina">
 
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
   <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>

    <Engine defaultHost="localhost" name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
      </Host>
    </Engine>
  </Service>
</Server>

Re: ClassLoadingException

Posted: Thu Nov 27, 2014 5:08 am
by Sajith S
Adding hibernate dependencies to my pom.xml fixed this Exception. Now the site runs smoothly.

Code: Select all

<dependency>
   <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.7.ga</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>

Re: ClassLoadingException

Posted: Tue Dec 02, 2014 7:55 pm
by phillipuniverse
Just an FYI, we recommend running on at least Tomcat 7. Thanks for posting back the fix.

Re: ClassLoadingException

Posted: Tue Dec 02, 2014 10:41 pm
by Sajith S
Thank You.