I'm getting this error using eclipse and glassfish server... This is working fine using netbeans and tomcat.. is there other way to call a servlet in glassfish?
HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
description The server encountered an internal error that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class
com.ob.source.QueryService
root cause
java.lang.NoClassDefFoundError: org/json/JSONException
root cause
java.lang.ClassNotFoundException: org.json.JSONException
GlassFish Server Open Source Edition 4.0
Ajax
function GetDetails(sr_no){
$.ajax({
type: "POST",
url: "qs",
data: "{\"sr_no\":" + '"' + sr_no + "\"}",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(response) {
var resultsArray = (typeof response) == 'string' ? eval('(' + response+ ')') : response;
var data = "";
$("#city").empty();
for(var i=0; i<resultsArray.length;i++){
data = resultsArray[0].frontline_owner;
}
$("#city").val(data);
}
});
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>json</display-name>
<servlet>
<servlet-name>QueryService</servlet-name>
<servlet-class>org.json.source.QueryService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>QueryService</servlet-name>
<url-pattern>/qs</url-pattern>
</servlet-mapping>
</web-app>