开发者

Webapp couldn't find jars located in WEB-INF/lib folder

开发者 https://www.devze.com 2022-12-30 10:54 出处:网络
On production Tomcat server my webapp couldn\'t find jars located in WEB-INF/lib folder. In development eviorment all works fine.

On production Tomcat server my webapp couldn't find jars located in WEB-INF/lib folder. In development eviorment all works fine.

Stack Trace

javax.servlet.ServletException: Could not initialize class util.HibernateUtil
    web.Engine.service(Engine.java:58)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
root cause

java.lang.NoClassDefFoun开发者_如何学编程dError: Could not initialize class util.HibernateUtil
    web.Engine.service(Engine.java:31)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.

Development Config

Tomcat 5.5

OS X 10.6

Eclipse

Production Config

Tomcat 5.5

Linux Debian

Thanks for your answer!


By default, the Tomcat that ships with Debian distros has a very restrictive Java security manager. My guess is that you're using the packaged version and that it is forbidding something. The "something" is very likely available in the logs as mentioned in the last line of the trace you posted:

note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.

You'll have to ease the restrictions (check /etc/tomcat5.5/policy.d) or to turn it off. Talk with your administrator.


I have seen something very similar with a jar requiring a class from another jar and that jar was not on the classpath.

Have a look at the root cause of the stack trace in the Tomcat log. That will most likely reveal what is wrong.

0

精彩评论

暂无评论...
验证码 换一张
取 消