• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

not able to deploy an application developed in struts1.2 and hibernate2 on to weblogic12c

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to deploy an application developed in struts1.2 and hibernate2 on to weblogic 12c app server and I am getting hibernate related exceptions as below. The same application works fine in weblogic 11g. is that something related to hibernate version. Do I need to upgrade it to latest version of hibernate? please advise.



java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
at com.kihost.struts.model.UserModel.getUserLogin(UserModel.java:54)
at com.kihost.struts.action.LoginAction.execute(LoginAction.java:59)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:243)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3432)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.HibernateException
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:357)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50)
... 25 more

Thanks in advance,

 
Ranch Hand
Posts: 355
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weblogic doesn't come with Hibernate libraries, unless it has been modified the classpath manually.

The error is clear: you don't have: net.sf.hibernate.HibernateException in the classpath.

Make sure, the hibernate mentioned above is packaged in the application.
Probably after providing this missing library, another exception will appear (the root cause).
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for your immediate response. The thing is its a maven project and I have my jars as dependencies in pom.xml
 
German Gonzalez-Morris
Ranch Hand
Posts: 355
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, but those jars must be packaged into the war/ear file that you are deploying to WLS.

Can you check that Hibernate library is packaged ?
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your response. Let me give more insight on my project. I do see the jar files being packaged in the war file . The folders inside my war file are

media
META-INF
scripts
WEB-INF
index.jsp


Inside WEB_INF I have a lib folder that has all the jar files including hibernate 2.0.1.jar

The dependencies I am using are

commons-lang 2.0
commons-collections 3.2
cglib-asm 1.0
jaxp-api 1.4.2
struts 1.2.9
struts-menu 2.3
jstl 1.0.6
odmg 3.0
oracle-ojdbc6 11.2.0.3.0
sax 2.0.1
saxpath 1.0-FCS
velocity 1.3
velocity-tool 1.1
xalan 2.5.1
xdoclet 2.0.7
xerces 2.4.0
xml-apis 2.0.2
standard 1.0.6
hibernate 2.0.1
dom 2.3.0-jaxb-1.0.6
dom4j 1.6
xdoclet 1.2b4
xjavadoc 1.0
xdoclet-xdoclet-module 1.2b4
xdoclet-hibernate-module 1.2b4
log4j 1.2.8
jaxen full
cglib 3.1
asm 3.3.1



Thanks,
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, I missed to add few more points.

The first time when I launch the application I get the login page since it is not database driven. When I try to login first I get the below error

Error 500--Internal Server Error
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
at net.sf.cglib.ASMBackend.init(ASMBackend.java:78)
at net.sf.cglib.ASMBackend.begin_constructor(ASMBackend.java:296)
at net.sf.cglib.CodeGenerator.begin_constructor(CodeGenerator.java:281)
at net.sf.cglib.CodeGenerator.begin_constructor(CodeGenerator.java:274)
at net.sf.cglib.CodeGenerator.generateNullConstructor(CodeGenerator.java:970)
at net.sf.cglib.KeyFactoryGenerator.generate(KeyFactoryGenerator.java:105)
at net.sf.cglib.CodeGenerator.define(CodeGenerator.java:163)
at net.sf.cglib.KeyFactory.create(KeyFactory.java:114)
at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:318)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:618)
at com.kihost.struts.model.HibernateSession.currentSession(HibernateSession.java:49)
at com.kihost.struts.model.UserModel.getUserLogin(UserModel.java:54)
at com.kihost.struts.action.LoginAction.execute(LoginAction.java:59)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)

and second time when I try to login I get



java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
at com.kihost.struts.model.UserModel.getUserLogin(UserModel.java:54)

The main point is the same war file works fine in weblogic 10.3.6


Thanks,

 
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

usha pillai wrote:



The exception above is usually caused by using a different version of a library than the required one. Are you requiring asm 3.3.1 in your Maven configuration or are you letting hibernate bring that library in? You should check what version of ASM Hibernate depends on.
If the application works in a different version of Weblogic, the server itself may have a different version of the library and be using it instead of the library you provide. Does your weblogic.xml file have the prefer-web-inf-classes property set? If not, try enabling that. It will prevent Weblogic from using its classes first.
 
German Gonzalez-Morris
Ranch Hand
Posts: 355
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to check from which jar file are loaded specific classes, is setting the parameter: -verbose:class
to the JRE.

This will give you a hint on this classloading issue.
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks both of you for your responses. Actually I do not have a weblogic.xml file in my project. is it required in order to deploy an application in 12c?
 
Joe Ess
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the documentation:

If your Web application does not contain a weblogic.xml deployment descriptor, WebLogic Server 12.1.3 automatically selects the default values of the deployment descriptor elements.


So it is not required, but if you do not have one, the server will choose classes from its classpath before looking at your application's JAR files. See here


prefer-web-inf-classes
The prefer-web-inf-classes element, if set to true, will cause classes located in the WEB-INF directory of a Web application to be loaded in preference to classes loaded in the application or system classloader. The default value is false.



This could explain the behavior you are seeing.
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually I added weblogic.xml file and added the prefer-web-inf-classes element as below,

<?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/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
<wls:weblogic-version>12.1.3</wls:weblogic-version>


<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</wls:weblogic-web-app>



but when I launched the application I got an error as below:

Compilation of JSP File '/index.jsp' failed:
--------------------------------------------------------------------------------

index.jsp:3:2: Type mismatch: cannot convert from Tag to JspTag
<jsp:forward page="index.do" />
^---------^
index.jsp:5:2: Type mismatch: cannot convert from InsertTag to JspTag
<tiles:insert definition="login" flush="true" />
^----------^
index.jsp:5:49: The method _releaseTags(PageContext, JspTag) in the type __index is not applicable for the arguments (PageContext, InsertTag)
<tiles:insert definition="login" flush="true" />
^
index.jsp:5:49: Type mismatch: cannot convert from Tag to JspTag
<tiles:insert definition="login" flush="true" />
^
 
usha pillai
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have fixed this issue by adding <wls:prefer-application-packages> element to weblogic.xml as below.

<wls:prefer-application-packages>
<wls:package-name>net.sf.hibernate</wls:package-name>
<wls:package-name>org.objectweb.asm</wls:package-name>
</wls:prefer-application-packages>


Thanks for all your help.







 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!