2 Replies Latest reply on May 1, 2012 5:53 PM by ezhangtina2

    Does anyone know how I can directly use classes under sun.awt namespace in a JBOSS 7.1 servelet?

    ezhangtina2

      I posted this question in stackoverflow a few days ago and repost it here.

       

      We have a customer who create a servelet to be hosted in JBOSS 7.1 on Windows 7 64-bit and the servelet uses the java classes in a jar file we develop. One of our classes makes use of sun.awt.DisplayChangedListener interface. The problem is that we get NoClassDefFoundError exception from the class that uses the DisplayChangedListener when the servelet is called and DisplayChangedListener is the root cause. There is no problem with many other classes in the same rt.jar file where DisplayChangedListener also resides. I use process explorer to look at the jar files the JBOSS process loads and only one rt.jar file is there. If I run the same codes directly using java, I have no problem. If I place a copy of rt.jar file to the local repository of the deployed servelet application in JBOSS, there is no problem as well. I know classes under sun.awt namespace are supposed to use internally not by developers, and it seems like the JBOSS class loader reinforece the restriction on their use. Is there any way I can make it work without the local copy of rt.jar and without abandoning the use of DisplayChangedListener interface (such as through some setting in configuration files)?  Our library that uses the DisplayChangedListener interface has been shipped to our customers for almost 2 years and some customers don't want to wait/upgrade to the next release.

       

      Thanks in advance for any help.