users@glassfish.java.net

Problems with classloading

From: Gerald Beuchelt <beuchelt_at_sun.com>
Date: Tue, 30 Oct 2007 14:28:10 -0400

I have a significant problem with the class loader - this applies to all
GFv2 (FCS and UR1) builds I have worked with so far:

When trying to do this:

public class WSSSignatureProvider extends AMSignatureProvider {
   
    public WSSSignatureProvider() {
        super();

        String strTransform = STRTransform.class.getCanonicalName();

        try {
            Transform.register(STRTransform.STR_TRANSFORM_URI,
                    strTransform );
        } catch (Exception e) {
            if(WSSUtils.debug.messageEnabled()) {
               WSSUtils.debug.message("WSSSignatureProvider.constructor:
STR"+
                    " Transform is already registered");
            }
        }
    }
}

I get the following failure:

[#|2007-10-30T14:01:06.415-0400|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=14;_ThreadName=httpSSLWorkerThread-8181-0;_RequestID=ed5b6c41-776c-4635-9fba-963a43343ff0;|java.lang.ClassNotFoundException:
com.sun.identity.wss.security.STRTransform
    at
com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:129)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at
com.sun.org.apache.xml.internal.security.transforms.Transform.register(Unknown
Source)
    at
com.sun.identity.wss.xmlsig.WSSSignatureProvider.<init>(WSSSignatureProvider.java:69)
    at
com.sun.identity.wss.security.WSSUtils.getXMLSignatureManager(WSSUtils.java:434)
    at
com.sun.identity.wss.security.AMTokenProvider.<init>(AMTokenProvider.java:84)
    at
com.sun.identity.wss.security.SecurityTokenFactory.getInstance(SecurityTokenFactory.java:66)
    at
com.sun.identity.wss.sts.spi.FAMUsernamePasswordValidator.validate(FAMUsernamePasswordValidator.java:86)
    at
com.sun.xml.wss.impl.callback.PasswordValidationCallback.getResult(PasswordValidationCallback.java:62)
    at
com.sun.xml.wss.impl.misc.DefaultSecurityEnvironmentImpl.authenticateUser(DefaultSecurityEnvironmentImpl.java:914)
    at
com.sun.xml.ws.security.opt.impl.incoming.UsernameTokenHeader.validate(UsernameTokenHeader.java:118)
    at
com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.handleSecurityHeader(SecurityRecipient.java:320)
    at
com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.cacheHeaders(SecurityRecipient.java:255)
    at
com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:205)
    at
com.sun.xml.wss.jaxws.impl.SecurityPipeBase.verifyInboundMessage(SecurityPipeBase.java:432)
    at
com.sun.xml.wss.jaxws.impl.SecurityServerPipe.process(SecurityServerPipe.java:182)
    at
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
    at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
    at
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at com.sun.identity.setup.AMSetupFilter.doFilter(AMSetupFilter.java:75)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
    at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
    at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
    at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
    at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
    at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at
com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.process(SSLReadTask.java:440)
    at
com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.doTask(SSLReadTask.java:228)
    at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
|#]

The STRTransform class part of the same WAR. Since I do not have any
control over the com.sun....Transform.register() method, I cannot go for
an explicit classloader. I also tried to put my JARs in the
<installRoot>/lib folder without any success and set the classpath of
the JVM explicitly to a JAR containing the class.

Any suggestions?


Gerald