应用部署在Linux上运输是报NoClassDefFoundError,因为应用使用了AWT。
[05/05/11 11:45:05:898 CST] 00000042 WebApp E SRVE0026E: [Servlet Error]-[ImageCodeServlet]: java.lang.NoClassDefFoundError: java.awt.image.BufferedImage (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at com.buyberry.common.util.ImageGen.creatImage(Unknown Source)
at com.buyberry.common.servlet.ImageCodeServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1796)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:887)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3226)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:248)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1971)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:130)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:434)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:373)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
Caused by: java.lang.UnsatisfiedLinkError: awt (libXp.so.6: cannot open shared object file: No such file or directory)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:980)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:944)
at java.lang.System.loadLibrary(System.java:409)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:76)
at java.security.AccessController.doPrivileged(AccessController.java:197)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:81)
at java.awt.image.BufferedImage.(BufferedImage.java:244)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
... 19 more
在RHEL4之后,JDK5在Linux上会使用Linux的native library libXp。这个库文件在RHEL4的版本是由xorg-deprecated-libs提供,在RHEL5是由libXp提供。
RHEL5解决方法如下:
rpm -Uvh libXp-1.0.0-8.1.el5.*rpm