Hoover's API Forums

Ask a Question

RSS Feed

Getting exception in running "SampleHapiConnectJava" demo application

  1. I'm getting following exception while running "SampleHapiConnectJava" demo application which i downloaded from "http://developer.hoovers.com/page/docs". This project demonstrates how to call Hoover's API using the Spring Framework. I did following steps:
    1) Modified WEB-INF/classes/applicationContext.xml with your API key, username,
    and password.
    1) Build the demo application
    2) Deployed it in Tomcat and called the
    tester.jsp to called the methods in HapiDemo.

    Please suggest a solution ASAP and let me know if i've done anything above wrong.

    exception

    org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.ws.soap.saaj.support.SaajUtils
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:414)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    root cause

    javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.ws.soap.saaj.support.SaajUtils
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
    org.apache.jsp.tester_jsp._jspService(tester_jsp.java:164)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    Message edited by Alexander Motsenigos 6 years ago

  2. Alexander Motsenigos7 years ago

    I am able to get rid of above problem but landed into a new one. I downgrade by JDK from 1.6 to 1.5 and use "saaj-api-1.3" and "saaj-impl-1.3" jar files. This resolve my above problem but now I'm getting a new exception mentioned below :

    org.springframework.ws.client.WebServiceTransportException: Internal Server Error [500]
    at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:627)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:551)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
    at com.hoovers.webservice.springdemo.SpringDemoClient.advancedCompanySearch(SpringDemoClient.java:166)
    at com.hoovers.webservice.springdemo.SpringDemo.makeCall(SpringDemo.java:23)
    at org.apache.jsp.tester_jsp._jspService(tester_jsp.java:144)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:818)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
    at java.lang.Thread.run(Thread.java:595)

    Please suggest a solution of above exception.

    One more query:- Can not we use JDK 1.6 with SAAJ 1.3 API (Downgrading is required)? Ideally my application is using JDK 1.6 and we can not think of downgrading it.

  3. Prabhakaran6 years ago

    Cause:

    The client code that you downloaded from our website will run good in JRE version 1.5. But if the same client ode is run in JRE_1.6, which is your environment, there will be many class loading issues. This is because, JDK1.6 has its own implementation of SAAJ. So, Tomcat's class loader will first load the the JDK1.6's SAAJ jar and not our client code SAAJ jar. Therefore, NoclassDef error will occur.

    Solution:

    So, In order to make the Tomcat load the thirdparty's(SAAJ) jar first before JDK1.6 SAAJ jar, we have to place those jars in Tomcat's endorsed directory.

    THINGS TO DO

    Step 1: create a folder named "endorsed" in the Tomcat's home directory. Step 2: Copy and paste the below 2 jars into this "endorsed" folder. You can find these jars in our project's "WEB-INF/lib" directory. saaj-api-1.3.jar saaj-impl-1.3.jar Step 3: Please verify now. Your tomcat directory will have to look like below apache-tomcat-6.0.16/endorsed/saaj-api-1.3.jar apache-tomcat-6.0.16/endorsed/saaj-impl-1.3.jar Step 4: Restart the Tomcat. Hit the URL.

    I hope, this will work for sure. Please let me know, if you have any further issues.

[ Page 1 of 1 ]

This topic is locked and new posts are not allowed