Jetty
  1. Jetty
  2. JETTY-420

jetty 6.1 & jdk 6: Linkage error

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6.1.16
    • Fix Version/s: None
    • Component/s: Maven, Servlet
    • Labels:
      None
    • Environment:
      Linux, 32-bit (Ubuntu 7.04)
    • Number of attachments :
      1

      Description

      I'm using the maven-jetty-plugin while developing a web service client (using JAX-WS/JAXB). Up till now I've been using jdk 5, but decided to try using it on jdk 6. What happens now is that as soon as JAX-WS attempts to access the WS I get the following exception:

      java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.sun.xml.ws.message.jaxb.AttachmentMarshallerImpl.addMtomAttachment(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" the class loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) of the current class, com/sun/xml/ws/message/jaxb/AttachmentMarshallerImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type javax/activation/DataHandler used in the signature
      at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:292)
      at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:128)
      at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:94)
      at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:251)
      at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:130)
      at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:74)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)
      at com.sun.xml.ws.client.Stub.process(Stub.java:235)
      at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:120)
      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:230)
      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
      at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
      at $Proxy51.getProbeNames(Unknown Source)
      at com.exiqon.flexselect.client.service.FlexDesignServiceImpl.processProbeNamesList(FlexDesignServiceImpl.java:59)
      at com.exiqon.flexselect.client.service.FlexDesignServiceImpl.<init>(FlexDesignServiceImpl.java:42)
      at com.exiqon.flexselect.client.service.FlexDesignServiceImpl.<clinit>(FlexDesignServiceImpl.java:30)
      at com.exiqon.flexselect.client.wicket.SelectionPage.<init>(SelectionPage.java:37)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at java.lang.Class.newInstance0(Class.java:355)
      at java.lang.Class.newInstance(Class.java:308)
      at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:58)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:256)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:277)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:205)
      at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:90)
      at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1031)
      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1107)
      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1176)
      at org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:257)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:127)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:313)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:389)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

      Any help would be greatly appreciated.

      1. mvn.out
        65 kB
        Guūmundur Bjarni ”lafsson

        Activity

        Hide
        Jan Bartel added a comment -

        I have run the jetty 6.1.15 maven plugin under jdk 1.5 and under jdk 1.6 using mvn -X jetty:run.

        When running under jdk1.5, I can see that the activation.jar is pulled onto the classpath. However, under jdk1.6, the activation.jar is NOT on the classpath. This is as expected, as there is a <profile> in the jetty plus naming module that selectively puts activation.jar on the classpath depending on the jdk being used.

        So, as far as I can determine, things are working exactly as expected and desired. At this point, if activation.jar is on the classpath, I can't see that it is because of the maven jetty plugin.

        If someone is still experiencing a problem under 6.1.15, can they please run with "mvn -X jetty:run" and post the "pluginArtifacts" from the output.

        thanks
        Jan

        Show
        Jan Bartel added a comment - I have run the jetty 6.1.15 maven plugin under jdk 1.5 and under jdk 1.6 using mvn -X jetty:run. When running under jdk1.5, I can see that the activation.jar is pulled onto the classpath. However, under jdk1.6, the activation.jar is NOT on the classpath. This is as expected, as there is a <profile> in the jetty plus naming module that selectively puts activation.jar on the classpath depending on the jdk being used. So, as far as I can determine, things are working exactly as expected and desired. At this point, if activation.jar is on the classpath, I can't see that it is because of the maven jetty plugin. If someone is still experiencing a problem under 6.1.15, can they please run with "mvn -X jetty:run" and post the "pluginArtifacts" from the output. thanks Jan
        Hide
        Hiroshi Koizumi added a comment -

        Hi ricard, I understand you use CXF. Could you remove these JARs from your WAR deployment? If your problem goes away this way, then there is nothing to do with Jetty side. You can find this list in apache-cxf-2.1.3/lib/WHICH_JARS.

        • geronimo-activation.jar (Or the Sun equivalent) [6]
        • geronimo-annotation.jar (Or the Sun equivalent) [6]
        • geronimo-javamail.jar (Or the Sun equivalent) [6]
        • geronimo-stax-api.jar (Or the Sun equivalent) [6]
        • jaxb-api.jar [6]
        • wstx-asl.jar [6]
        • geronimo-ws-metadata.jar [6]
        • geronimo-jaxws_2.1_spec-1.0.jar (Or the Sun equivalent) [6]
        • saaj-api.jar [6]
        • saaj-impl.jar [6]
        Show
        Hiroshi Koizumi added a comment - Hi ricard, I understand you use CXF. Could you remove these JARs from your WAR deployment? If your problem goes away this way, then there is nothing to do with Jetty side. You can find this list in apache-cxf-2.1.3/lib/WHICH_JARS. geronimo-activation.jar (Or the Sun equivalent) [6] geronimo-annotation.jar (Or the Sun equivalent) [6] geronimo-javamail.jar (Or the Sun equivalent) [6] geronimo-stax-api.jar (Or the Sun equivalent) [6] jaxb-api.jar [6] wstx-asl.jar [6] geronimo-ws-metadata.jar [6] geronimo-jaxws_2.1_spec-1.0.jar (Or the Sun equivalent) [6] saaj-api.jar [6] saaj-impl.jar [6]
        Hide
        Jan Bartel added a comment -

        I'm going to close this issue for now, as nobody has come back with any evidence of a jetty problem, so it looks like a configuration issue to me. Please reopen if you can demonstrate a problem that needs fixing.

        Show
        Jan Bartel added a comment - I'm going to close this issue for now, as nobody has come back with any evidence of a jetty problem, so it looks like a configuration issue to me. Please reopen if you can demonstrate a problem that needs fixing.
        Hide
        Baptiste GAILLARD added a comment -

        I'm not absolutly sure about that but I think the problem does not come from Jetty but javax.mail.

        On my project all the Maven projects have a dependency on log4j-1.2.15.jar, and log4j depends on javax.mail (version 1.4).

        In the javax.mail:mail-1.4.pom file we can find:
        <dependencies>
        <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1</version>
        </dependency>
        </dependencies>

        But this shouldn't be done with the JDK1.6, so to solve the problem juste add an exclusion on javax.mail or log4j:
        <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>$

        {log4j.version}

        </version>
        <type>jar</type>
        <scope>runtime</scope>
        <exclusions>
        <!--
        Because the JDK1.6 already include the Java Activation API,
        otherwise this could generate ClassLoading en Linkage errors
        -->
        <exclusion>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        </exclusion>
        </exclusions>
        </dependency>

        Hope this help.

        Baptiste

        Show
        Baptiste GAILLARD added a comment - I'm not absolutly sure about that but I think the problem does not come from Jetty but javax.mail. On my project all the Maven projects have a dependency on log4j-1.2.15.jar, and log4j depends on javax.mail (version 1.4). In the javax.mail:mail-1.4.pom file we can find: <dependencies> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> </dependency> </dependencies> But this shouldn't be done with the JDK1.6, so to solve the problem juste add an exclusion on javax.mail or log4j: <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>$ {log4j.version} </version> <type>jar</type> <scope>runtime</scope> <exclusions> <!-- Because the JDK1.6 already include the Java Activation API, otherwise this could generate ClassLoading en Linkage errors --> <exclusion> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> </exclusion> </exclusions> </dependency> Hope this help. Baptiste
        Hide
        race spider added a comment -

        Java 1.6 already provide feature of Activation.jar.
        so remove Activation.jar from your project lib dir or Server

        Show
        race spider added a comment - Java 1.6 already provide feature of Activation.jar. so remove Activation.jar from your project lib dir or Server

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Guūmundur Bjarni ”lafsson
          • Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: