1

I have created a restful webservice from mysql database and used it's default world schema. I used Glassfish Server 4.1.1.

Now, when I test the restful webservice with another test web project a 500 (Internal Server Error) occurs.

GET RequestFailed RequestFailed --> Status: (500)
Response:{

HTTP Status 500 - Internal Server Error
type: Exception report
message: Internal Server Error
description: The server encountered an internal error that prevented it from fulfilling this request.

exception: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException

root cause:
org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException

java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException

java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException not found by org.eclipse.persistence.moxy [227]

Notes:

1) My entity classes are working fine. When run the url http://localhost:8080/RestfulAPI/webresources/com.rakin.city then i could see all the data in a xml file.

enter image description here

2) I tried some solutions and add jersy libraries in the webservice but it didn't solve my problem either. After adding jersy libraries it couldn't access WADL

enter image description here

I restarted the glassfish server and the resp application but the same problem occurs again and again.

3)My project file and libraries:

enter image description here

S.Rakin
  • 812
  • 1
  • 11
  • 24
  • Well the exception clearly points that some libs are missing so could you double check that your project gets properly deployed? Secondly, the missing class might suggest that you haven't configured properly your marshaller classes or the request/response entities. Try consuming it first with a test client like SOAP UI or smth, in order to better understand its behavior – AntJavaDev Jul 08 '17 at 09:30
  • Also check this [link](https://stackoverflow.com/questions/33129219/class-not-found-when-using-jax-rs-with-eclipse-and-glassfish]) , at the glassfish related answer. Might be useful – AntJavaDev Jul 08 '17 at 09:36

1 Answers1

0

add javax.xml.parsers dependency into your pom.xml file.

https://mvnrepository.com/artifact/javax.xml.parsers/jaxp-api/1.4.5

Mandeep Singh
  • 91
  • 1
  • 1
  • 8
  • 1
    Get a jar file from here and include into your project. http://www.java2s.com/Code/Jar/j/Downloadjavaxxmlparsers11jar.htm – Mandeep Singh Jul 09 '17 at 05:24