0 Replies Latest reply on Jan 7, 2011 12:02 PM by shiva007

    LinkageError when trying to process incoming XML

    shiva007

      Any help would be welcome. Sorry if I am not supposed to post here. But this looks like a class-loading/JAR-hell issue after some investigation.

       

      We added the following code to process an incoming XML using XPath. The server is JBoss 4.0.5. The code is as follows (I am putting the 2 functions in the class that were added):

       

      public void checkForRecovery(String reportXml, Claim targetClaim, Damage damage) {

              XPath xpath = getXPath();

              try {

                  Document doc = getXmlDocumentFromReportXmlString(reportXml);

                  NodeList typeCodeNode = getMatchReportTypeCodeNode(xpath, doc);

                  if (typeCodeNode.getLength() > 0

                          && typeCodeNode.item(0).getNodeValue().equals("V")

                          && damage instanceof PhysicalDamage

                          && ((PhysicalDamage) damage).getTotalTheftVehicleDamageExposure() != null) {

                      ((PhysicalDamage) damage).getTotalTheftVehicleDamageExposure().setHasRecoveryNotice(true);

                      String commercialName = "",recoveryDate = "";

                      XPathExpression exprRecoveryDate = xpath.compile("//RecoveryInfo/RecoveryDt/text()");

                      NodeList recoveryDateNode = (NodeList)exprRecoveryDate.evaluate(doc, XPathConstants.NODESET);

                      if(recoveryDateNode.getLength() > 0){

                          recoveryDate = recoveryDateNode.item(0).getNodeValue();

                      }

                      XPathExpression exprAddress = xpath.compile("//RecoveryInfo/Addr/*");

                      NodeList commercialNameNode = (NodeList) exprAddress.evaluate(doc, XPathConstants.NODESET);

                      if(commercialNameNode.getLength() > 0 && commercialNameNode.item(0).getNodeName().equals("CommercialName")){

                          commercialName = commercialNameNode.item(0).getTextContent();

                      }

                      addRecoveryNoteToClaim(targetClaim, commercialName, recoveryDate);

                      addRecoveryDiaryToClaim(targetClaim);               

                  }

       

              } catch (XPathExpressionException e) {

                  isoReportLogger.logToDatabase(targetClaim.getSurrogateClaimNumber(), "Error in ISO Recovery - XPath Expression", e, "");

                  e.printStackTrace();

              }catch (ParserConfigurationException e) {

                  isoReportLogger.logToDatabase(targetClaim.getSurrogateClaimNumber(), "Error in ISO Recovery - Parser Configurations Expression", e, "");

                  e.printStackTrace();

              } catch (SAXException e) {

                  isoReportLogger.logToDatabase(targetClaim.getSurrogateClaimNumber(), "Error in ISO Recovery - SAX Parser Exception", e, "");

                  e.printStackTrace();

              } catch (IOException e) {

                  isoReportLogger.logToDatabase(targetClaim.getSurrogateClaimNumber(), "Error in ISO Recovery - IO Error converting report XML to input stream", e, "");

                  e.printStackTrace();

              }

       

          }

       

      private XPath getXPath() {

              XPathFactory factory2 = XPathFactory.newInstance();

              XPath xpath = factory2.newXPath();

              return xpath;

          }

       

       

      ===========================================================================================================

      The errors we got in the log when trying to access this code in the app is as follows (bolded line is where the error is got):

      2011-01-06 10:38:10,614 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error in method: public abstract void com.nationwide.thi.jclaims.shared.ejb.iso.IsoReportLocal.saveIndexReport(java.lang.String

      )

      java.lang.LinkageError: loader constraints violated when linking javax/xml/namespace/QName class

      ...........

      ............

      java.lang.LinkageError: loader constraints violated when linking javax/xml/namespace/QName class

              at org.apache.xpath.jaxp.XPathFactoryImpl.newXPath(XPathFactoryImpl.java:103)

              at com.nationwide.thi.jclaims.biz.service.vendor.IsoReportServiceImpl.getXPath(IsoReportServiceImpl.java:303)

              at com.nationwide.thi.jclaims.biz.service.vendor.IsoReportServiceImpl.checkForRecovery(IsoReportServiceImpl.java:114)

              at com.nationwide.thi.jclaims.biz.service.vendor.IsoReportServiceImpl.addReport(IsoReportServiceImpl.java:94)

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

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

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

              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)

              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

              at $Proxy202.addReport(Unknown Source)

              at com.nationwide.thi.jclaims.biz.ejb.iso.IsoReportBean.saveIndexReport(IsoReportBean.java:21)

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

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

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

              at org.jboss.invocation.Invocation.performCall(Invocation.java:359)

              at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)

              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)

              at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)

              at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)

              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)

              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)

              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)

              at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)

              at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)

              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)

              at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)

              at org.jboss.ejb.Container.invoke(Container.java:954)

              at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)

              at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)

              at $Proxy146.saveIndexReport(Unknown Source)

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

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

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

              at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invokeInContext(LocalSlsbInvokerInterceptor.java:70)

              at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:188)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

              at $Proxy152.saveIndexReport(Unknown Source)

              at com.nationwide.thi.ws.isoreport.IsoReportServiceProxy.saveIndexReport(IsoReportServiceProxy.java:10)

              at com.nationwide.thi.ws.common.JClaimsServices.saveIndexReport(JClaimsServices.java:28)

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

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

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

              at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)

              at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:98)

              at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)

              at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)

              at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)

              at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:125)

              at org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:78)

              at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processXMLRequest(AxisServlet.java:788)

              at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:193)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

       

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)

              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)

              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

              at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)

              at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

              at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

              at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:113)

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

       

       

       

      =====================

       

      Thanks,

      Shivakumar.