0 Replies Latest reply on Nov 3, 2015 5:15 AM by Henning Ellerweg

    Jackson Classloading EAP 6.4

    Henning Ellerweg Newbie

      I made a small project which looks like this

      • playboss.ear
        • lib
          • commonlib.jar
            • JsonDeserializer.class
          • testlib.jar
            • JsonMessage.class
            • Version.class
          • jackson-1.9.4.jar
        • playboss_ejb.jar
          • MessageTimer.class


      JsonMessage has a member private Class<? extends Version> msgVersion = Version.V0.class;

      MessageTimer is just a Bean with a timeout which does nothing but deserializes an example String of JsonMessage using JsonDeserializer.

      Everything works fine, i.e. the String is converted  to JsonMessage!


      Now I add a dependency to my project containing a JAX-RS API and model objects such that lib is extended.

      • lib
        • SomeAPI.jar
        • javax.ws.rs-api-2.0.jar


      Now when I start the EAP I get the following exception:


      Caused by: java.lang.ClassNotFoundException: playground.testlib.Version$V0 from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @9e89d68

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.7.Final-redhat-1]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.7.Final-redhat-1]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.7.Final-redhat-1]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.7.Final-redhat-1]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.7.Final-redhat-1]

        at java.lang.Class.forName0(Native Method) [rt.jar:1.8.0_66]

        at java.lang.Class.forName(Class.java:264) [rt.jar:1.8.0_66]

        at org.codehaus.jackson.map.deser.std.ClassDeserializer.deserialize(ClassDeserializer.java:42) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4]



      I figure that due to https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments the jax-rs module dependency is triggered and jackson gets loaded from modules.


      My questions:

      1) What is the recommended / best way to get my deserialization working again

      2) I would like to understand how object mapping is done with jax-rs if the module classloader does obviously not see my model classes.