Topic
  • 11 replies
  • Latest Post - ‏2013-01-10T12:22:59Z by VV3R_mordechai_taitelman
SystemAdmin
SystemAdmin
2327 Posts

Pinned topic java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

‏2012-07-26T09:51:12Z |
Hi everyone,

I'm trying to follow this example (http://public.dhe.ibm.com/ibmdl/export/pub/software/mobile-solutions/worklight/docs/Module_06_1_-_Advanced_Adapter_Usage_and_Mashup.pdf) from IBM Worklight user documentation page, and I'm having troubles with it.

After deploy a SQL_Adapter (it's working properly) and HTTP_Adapter with their corresponding hybrid application within the embedded eclipse server (jetty-6.1.x), I'm trying to test the HTTP_Adapter with 'Invoke Worklight procedure' option and I'm getting this message:

{
"errors": [
"Runtime: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found\njava.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser"
],
"info": [
],
"isSuccessful": false,
"warnings": [
]
}

See Attached Server.log file for further information.

The really rare of this case (and with some previous similar cases) is that I've seen it working properly at least once (without apparently any changes in the code), but now I don't manage to make it works. The same happends with other examples (extracted from the same website), sometimes are working properly and sometimes no. I don't know, hassome of you faced with this rare behaviour?

This is my configuration environment, taking into account that I'm running a VMWare Image:
Operation System: Windows 7 Professional Edition SP1, version, 64 bit
Java: Oracle Java(TM) SE Runtime Environment (build 1.7.0_05-b05), 32 bit
Database: MySQL Server 5.5

If working on an Application Server:
Server type: Embedded Eclipse server (jetty-6.1.x)
Worklight jar: 5.0.1.299
Worklight plug-in (with which the project was built): com.worklight.studio.plugin_5.0.1.299

Installation type: Enterprise Edition 5.0
Eclipse: Eclipse Platform Version: 3.6.3
Worklight plug-in (with which the project was built): com.worklight.studio.plugin_5.0.1.299
Environment details:

More information:
Reproduction steps
1.- Deploy Worklight Adapter in embedded server (HTTP)
2.- Invoke Worklight Procedure with parameters:
1105779
3rd party libraries
Logs: Worklight server.log

Attachments

  • NQU4_Carl_Ober
    NQU4_Carl_Ober
    33 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2012-07-26T18:12:36Z  
    Did you put a xerces.jar in the server/lib? I know if the JAR is in your classpath but not in server/lib, the Worklight application won't pick it up unless it's part of the core Worklight libraries.
  • NQU4_Carl_Ober
    NQU4_Carl_Ober
    33 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2012-07-26T20:53:38Z  
    Did you put a xerces.jar in the server/lib? I know if the JAR is in your classpath but not in server/lib, the Worklight application won't pick it up unless it's part of the core Worklight libraries.
    You may also want to try calling this before initializing the SAXParser; this worked for me for another instance of ClassNotFoundException.

    Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2012-07-31T07:39:13Z  
    Did you put a xerces.jar in the server/lib? I know if the JAR is in your classpath but not in server/lib, the Worklight application won't pick it up unless it's part of the core Worklight libraries.
    Hi NQU4_Carl_Ober,

    first of all many thanks for your response. I tried to put "xercesImpl-2.6.2.jar" within the server/lib folder of the project and then deploy it again, but I'm still getting the same error. The most curious of this, is that I've seen it working properly at least once, without the necessity to include any extra library. From my humble point of view, this library should be included within the core WL Server / Jetty.

    I don't know, I'll keep on going with the investigation, any way many thanks again for your time.
  • EF8H_Shengwang_Li
    EF8H_Shengwang_Li
    2 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2012-08-24T14:35:12Z  
    javier,

    I have the same problem with my development evnrionment. It works some days ago. But after that, It will report the exception forever. Do you have the solution?

    I suppose there is a big bug in the development envrionment when It deploying the project and will lost something.
  • KYYJ_Peter_Hood
    KYYJ_Peter_Hood
    2 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2012-10-22T13:27:49Z  
    Hi guys,

    Did u find a solution to the above? I am running into the exact same issue?
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-09T11:58:39Z  
    Hi guys,

    Did u find a solution to the above? I am running into the exact same issue?
    Hello All,

    According to my understanding this is not an issue of some jar. We all have the wrong path to the webservice we calling. I would be really appreciate that if any one tell me that how do we resolve this issue if we are doing some thing like that;
    1) Provider and Consumers are done and we are calling webservice(wsdl) file in our provider.
    2) What i am doing is to giving a path of the wsdl (which is tested and confirmed that it's working fine)
    3) I have taken the path of the wsdl and request as well.
    4) It is assured that the webservices is working fine and the SOAP request is perfect.
    5) http://localhost:8090/LostStolenServer/services/LostStolenCard --- This is the link let suppose and what i doing is like

    XML FILE:
    <connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
    <protocol>http</protocol>
    <domain>localhost</domain>
    <port>8090</port>
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>

    JS FILE:

    function getStories() {
    var interest ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://lsc.rc.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+
    ' <soapenv:Body>'+
    ' <q0:lostStolenCard>'+
    ' <q0:cardNo>123</q0:cardNo>'+
    '<q0:name>123</q0:name> '+
    '<q0:email>123</q0:email> '+
    '<q0:phoneNo>123</q0:phoneNo> '+
    '<q0:comments>123</q0:comments>'+
    '</q0:lostStolenCard>'+
    '</soapenv:Body>'+
    '</soapenv:Envelope>';
    path = getPath(interest);

    var input = {
    method : 'get',
    returnedContentType : 'xml',
    path : '/LostStolenServer/services/LostStolenCard',
    body: {
    content: interest.toString(),
    contentType: 'text/xml; charset=utf-8'

    }
    };
    return WL.Server.invokeHttp(input);
    }

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

    Above are the complete description what i am facing. If someone know it let me know. I would be really pleased :)

    thanks

    -Talha Haroon
  • VV3R_mordechai_taitelman
    43 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-09T12:21:05Z  
    Hi
    I have a short question which the SAX Parser exception reminds me:
    Do you happen to use JDK 1.7 ?
    If yes , can you retry that test with JDK 1.6?
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-09T12:54:52Z  
    Hi
    I have a short question which the SAX Parser exception reminds me:
    Do you happen to use JDK 1.7 ?
    If yes , can you retry that test with JDK 1.6?
    VV3R_mordechai_taitelman,

    I have jdk1.7, I didn't try jdk1.6
    I don't think it will make any difference on exception. what is remember in my past sometime( not sure)I had the similar error this would be resolved my correcting the path.

    Let me know if you have any knowledge regarding this buddy

    thanks

    -Talha
  • VV3R_mordechai_taitelman
    43 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-10T12:17:12Z  
    VV3R_mordechai_taitelman,

    I have jdk1.7, I didn't try jdk1.6
    I don't think it will make any difference on exception. what is remember in my past sometime( not sure)I had the similar error this would be resolved my correcting the path.

    Let me know if you have any knowledge regarding this buddy

    thanks

    -Talha
    Hi
    You will be surprised... please take 10 minutes to install Sun JDK 1.6.
    In worst case you wasted 10 min.
    Why I suspect this is the problem : In JDK 1.7 Sun removed some SAX classes which causes this exception if the code "assumes" certain JDK level.
  • VV3R_mordechai_taitelman
    43 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-10T12:18:03Z  
    Hi
    You will be surprised... please take 10 minutes to install Sun JDK 1.6.
    In worst case you wasted 10 min.
    Why I suspect this is the problem : In JDK 1.7 Sun removed some SAX classes which causes this exception if the code "assumes" certain JDK level.
    ops... I said Sun. I meant Oracle of course (no hurt feelings)
  • VV3R_mordechai_taitelman
    43 Posts

    Re: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    ‏2013-01-10T12:22:59Z  
    Hi
    You will be surprised... please take 10 minutes to install Sun JDK 1.6.
    In worst case you wasted 10 min.
    Why I suspect this is the problem : In JDK 1.7 Sun removed some SAX classes which causes this exception if the code "assumes" certain JDK level.
    Hi Talho

    org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
    java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

    For JDK 1.7: I did find a work-around that worked for me. In the Worklight.sh (Linux) or Worklight.bat (Windows) script that you use to launch the Studio, add a JVM flag:
    -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser parameter to the end of the eclipse command invocation to specify to use the default Oracle SAXParser. After editing, your script should look something like this