7 Replies Latest reply on Nov 14, 2019 5:10 AM by nickarls

    Accessing JDK classes in WF18

    nickarls

      I'm customizing some JAXB-encoding and have a custom CharacterEscapeHandler but on deployment I get a

       

      java.lang.ClassNotFoundException: com.sun.xml.bind.marshaller.CharacterEscapeHandler

       

      even if I have a jboss-deployments-structure.xml with

       

      <system export="true">
      <paths>
      <path name="com/sun/xml/bind/marshaller" />
      </paths>
      </system>
      
      
      
      
      

      in depenencies  (which is picked up since it reacts to typos)

       

      Pointers?

        • 1. Re: Accessing JDK classes in WF18
          jaikiran

          Is there a complete exception stacktrace that you can paste?

          • 2. Re: Accessing JDK classes in WF18
            nickarls

            Hi Jaikiran, long time no see, you're still around, I notice! ;-)

             

            This is what I'm seeing

             

            at java.util.concurrent.FutureTask.report(FutureTask.java:122)

            at java.util.concurrent.FutureTask.get(FutureTask.java:206)

            at com.acme.resepti.toimitus.service.saldo.SaldoManagerImpl$SaldoJob.run(SaldoManagerImpl.java:99)

            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

            at java.util.concurrent.FutureTask.run(FutureTask.java:266)

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

            at java.lang.Thread.run(Thread.java:748)

            Caused by: java.lang.NoClassDefFoundError: com/sun/xml/bind/marshaller/CharacterEscapeHandler

            at com.acme.resepti.toimitus.service.marela.impl.jaxb.JAXBUtil.marshal(JAXBUtil.java:22)

            at com.acme.resepti.toimitus.service.marela.impl.MessageFactory.getSaldokyselysanoma(MessageFactory.java:18)

            at com.acme.resepti.toimitus.service.marela.impl.MarelaServiceImpl.haeSaldo(MarelaServiceImpl.java:51)

            at com.acme.resepti.toimitus.service.marela.impl.MarelaServiceImpl$Proxy$_$$_WeldSubclass.haeSaldo$$super(Unknown Source)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:51)

            at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78)

            at com.acme.infra.security.role.SecurityInterceptor.intercept(SecurityInterceptor.java:28)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)

            at org.jboss.weld.interceptor.proxy.NonTerminalAroundInvokeInvocationContext.proceedInternal(NonTerminalAroundInvokeInvocationContext.java:66)

            at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78)

            at com.acme.infra.security.session.check.SessionCheckInterceptor.intercept(SessionCheckInterceptor.java:23)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)

            at org.jboss.weld.interceptor.proxy.NonTerminalAroundInvokeInvocationContext.proceedInternal(NonTerminalAroundInvokeInvocationContext.java:66)

            at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78)

            at com.acme.infra.message.MessageHandledInterceptor.intercept(MessageHandledInterceptor.java:19)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)

            at org.jboss.weld.interceptor.proxy.NonTerminalAroundInvokeInvocationContext.proceedInternal(NonTerminalAroundInvokeInvocationContext.java:66)

            at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78)

            at com.acme.infra.exception.ExceptionInterceptor.intercept(ExceptionInterceptor.java:36)

            at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)

            at org.jboss.weld.interceptor.proxy.NonTerminalAroundInvokeInvocationContext.proceedInternal(NonTerminalAroundInvokeInvocationContext.java:66)

            at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78)

            at com.acme.infra.logging.LoggingInterceptor.doStuff(LoggingInterceptor.java:32)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)

            at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84)

            at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72)

            at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56)

            at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79)

            at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68)

            at com.acme.resepti.toimitus.service.marela.impl.MarelaServiceImpl$Proxy$_$$_WeldSubclass.haeSaldo(Unknown Source)

            at com.acme.resepti.toimitus.service.saldo.SaldoManagerImpl$MarelaRequest.call(SaldoManagerImpl.java:63)

            at com.acme.resepti.toimitus.service.saldo.SaldoManagerImpl$MarelaRequest.call(SaldoManagerImpl.java:52)

            ... 4 more

            Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.marshaller.CharacterEscapeHandler from [Module "deployment.SaiRec-0.0.1-SNAPSHOT.war" from Service Module Loader]

            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)

            ... 59 more

            • 3. Re: Accessing JDK classes in WF18
              ctomc

              that is the version of JDK you are using? 8 or something post 8?

              • 4. Re: Accessing JDK classes in WF18
                nickarls

                java version "1.8.0_161"

                Java(TM) SE Runtime Environment (build 1.8.0_161-b12)

                Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

                • 5. Re: Accessing JDK classes in WF18
                  nickarls

                  Haven't tried deploying a bare-bone app with empty lib, although one wouldn't think(tm) that should matter

                  • 6. Re: Accessing JDK classes in WF18
                    nickarls

                    Umm... apparently com.sun.xml.bind.marshaller.CharacterEscapeHandler is not in the RT, have to check if adding a module ref to the jax-b impl helps

                    • 7. Re: Accessing JDK classes in WF18
                      nickarls

                      Apparently it was in

                       

                      <module name="com.sun.xml.bind" />

                       

                      sorry for the false alarm. The class sure sounded RT-ish