Spring 3.0.5 + Struts 1.2.2 + Weblogic 10.3.6 APIs Conflict (ClassNotFoundException: org.hibernate.hql.ast.HqlToken)

Environment:

Sprint 3.0.5

Struts 1.2.2

Weblogic 10.3.6

Situation

After successfully deploy a web project to Weblogic, I try to access the web site, but an exception occurs:

org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken ……

Cause

Some jars version are different from those in the web application; therefore cause the conflicts.

Solution

1. Use Classloader Analysis Tool(CAT) to check the conflicts (Only for development mode) .

Open Weblogic console->Deployment->[The Web App]->Testing->Classloader Analysis Tool->[Pop a new window]->select [The Web App]->Generate Report

2. Basically, it is the conflict of antlr package. Add filter to weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
 xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 
 http://xmlns.oracle.com/weblogic/weblogic-web-app 
 http://xmlns.oracle.com/weblogic/weblogic-web-app/1.3/weblogic-web-app.xsd">
 
 <wls:weblogic-version>10.3.6</wls:weblogic-version>
 <wls:context-root>my-web</wls:context-root>
 <wls:container-descriptor>
  <wls:prefer-application-packages>
   <wls:package-name>antlr.*</wls:package-name>
  </wls:prefer-application-packages>
 </wls:container-descriptor>
</wls:weblogic-web-app>

3. Some other conflict jars, you may decide to use those in the Weblogic. Therefore, remove them from WEB-INF/lib.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s