Uploaded image for project: 'Scout (Retired)'
  1. Scout (Retired)
  2. SCOUT-105

dont eat InvocationTargetException cause in org.apache.ws.scout.transport.LocalTransport

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.2
    • 1.2.3
    • Scout Implementation
    • None

    Description

      I am using org.apache.ws.scout.transport.LocalTransport with juddi-client 3.0.4. I had several exceptions in it because of wrong dependencies and inproper configuration. To resolve all these issues I had to manually debug the Scout code because the stacktraces of juddi-client are being eaten by LocalTransport.

      This is the problematic method:
      public Element send(Element request,URI endpointURI)
      throws TransportException
      {
      Element response = null;

      if (log.isDebugEnabled())

      { log.debug("\nRequest message:\n" + XMLUtils.convertNodeToXMLString(request)); log.debug("Calling " + endpointURI + " locally"); }

      try

      { String className = endpointURI.getPath(); String methodName = endpointURI.getFragment(); log.debug("Calling class=" + className); log.debug("Method=" + methodName); Class<?> c = Class.forName(className); Object requestHandler = c.newInstance(); Method method = c.getMethod(methodName, Element.class); Node node = (Node) method.invoke(requestHandler, request); response = (Element) node.getFirstChild(); }

      catch (InvocationTargetException ite)

      { throw new TransportException(new Exception(ite.getTargetException().getMessage())); }

      catch (Exception ex)

      { throw new TransportException(ex); }

      if (log.isDebugEnabled())

      { log.debug("\nResponse message:\n" + XMLUtils.convertNodeToXMLString(response)); }

      return response;
      }

      Because this part removes the stacktrace:
      ...
      } catch (InvocationTargetException ite) {
      throw new TransportException(new Exception(ite.getTargetException().getMessage()));
      }...

      I had to add a watch expression for ite.getTargetException().printStackTrace() to debug my issues. Finding this workaround and having to do this on my trial and error work caused quite a slow down in my progress.

      It would be better if you just removed that code part and let the follow-up catch-clause handle the errors:
      } catch (Exception ex) {
      throw new TransportException(ex);
      }

      Also, why do you wrap the Message in an Exception which is then wrapped by TransportException? This was quite confusing for me initially and in my opinion senseless.

      ------------------------------------------

      This is an example for the confusing stack trace currently generated by scout:
      Caused by - java.lang.Exception: org/apache/log4j/helpers/Loader
      at org.apache.ws.scout.transport.LocalTransport.send(LocalTransport.java:66)
      at org.apache.ws.scout.registry.RegistryV3Impl.execute(RegistryV3Impl.java:296)
      at org.apache.ws.scout.registry.RegistryV3Impl.getAuthToken(RegistryV3Impl.java:887)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.getAuthToken(BusinessLifeCycleManagerV3Impl.java:790)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.executeOperation(BusinessLifeCycleManagerV3Impl.java:565)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.saveOrganizations(BusinessLifeCycleManagerV3Impl.java:420)
      at de.invesdwin.gemeinsam.integration.ws.internal.jaxr.JaxrClient.registerService(JaxrClient.java:58)
      at de.invesdwin.gemeinsam.integration.ws.XsdWebServicePublikation.setBeanName(XsdWebServicePublikation.java:67)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.setupApplicationContext(BootstrapUtil.java:192)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.bootstrap(BootstrapUtil.java:159)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.autowire(BootstrapUtil.java:127)
      at de.invesdwin.gemeinsam.integration.ws.internal.WebServiceBootstrap.setApplicationContext(WebServiceBootstrap.java:16)
      at de.invesdwin.gemeinsam.webserver.Main.starteAnwendung(Main.java:33)
      at de.invesdwin.gemeinsam.bootstrap.AMain.<init>(AMain.java:32)
      at de.invesdwin.gemeinsam.webserver.Main.<init>(Main.java:18)
      at de.invesdwin.gemeinsam.webserver.Main.main(Main.java:22)
      at de.invesdwin.gemeinsam.integration.ws.XsdWebServicePublikationTest.main(XsdWebServicePublikationTest.java:17)
      ... 57 more, see error.log

      --------------------------------------------
      This is the stack trace i actually want which i got by adding my watch expression:
      java.lang.NoClassDefFoundError: org/apache/log4j/helpers/Loader
      at org.apache.juddi.v3.client.transport.wrapper.UDDISecurityService.secure(UDDISecurityService.java:63)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.ws.scout.transport.LocalTransport.send(LocalTransport.java:63)
      at org.apache.ws.scout.registry.RegistryV3Impl.execute(RegistryV3Impl.java:296)
      at org.apache.ws.scout.registry.RegistryV3Impl.getAuthToken(RegistryV3Impl.java:887)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.getAuthToken(BusinessLifeCycleManagerV3Impl.java:790)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.executeOperation(BusinessLifeCycleManagerV3Impl.java:565)
      at org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.saveOrganizations(BusinessLifeCycleManagerV3Impl.java:420)
      at de.invesdwin.gemeinsam.integration.ws.internal.jaxr.JaxrClient.registerService(JaxrClient.java:58)
      at de.invesdwin.gemeinsam.integration.ws.XsdWebServicePublikation.setBeanName(XsdWebServicePublikation.java:67)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1433)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1408)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.setupApplicationContext(BootstrapUtil.java:192)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.bootstrap(BootstrapUtil.java:159)
      at de.invesdwin.gemeinsam.bootstrap.BootstrapUtil.autowire(BootstrapUtil.java:127)
      at de.invesdwin.gemeinsam.integration.ws.internal.WebServiceBootstrap.setApplicationContext(WebServiceBootstrap.java:16)
      at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:106)
      at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:676)
      at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:381)
      at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:667)
      at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:264)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:999)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:610)
      at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:155)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:384)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
      at org.eclipse.jetty.server.Server.doStart(Server.java:243)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
      at de.invesdwin.gemeinsam.webserver.Main.starteAnwendung(Main.java:33)
      at de.invesdwin.gemeinsam.bootstrap.AMain.<init>(AMain.java:32)
      at de.invesdwin.gemeinsam.webserver.Main.<init>(Main.java:18)
      at de.invesdwin.gemeinsam.webserver.Main.main(Main.java:22)
      at de.invesdwin.gemeinsam.integration.ws.XsdWebServicePublikationTest.main(XsdWebServicePublikationTest.java:17)
      Caused by: java.lang.ClassNotFoundException: org.apache.log4j.helpers.Loader
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
      ... 79 more

      -------------------------------------------------------------

      This was even funnier in the beginning when juddi-client threw NullPointerExceptions, because Scout just printed the message "null" which was really helpful. :,D (crying laugh)

      Attachments

        Activity

          People

            kstam Kurt Stam
            subes subes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: