I have a small webservice program in which I need to import JSONObject from external jar. While trying to deploy the webservice, the Glassfish couldn't find the imported class (from external jar), but things look fine in IDE.
I tried to look into the log and found this :
[2017-11-17T16:22:49.429+0100] [glassfish 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1510932169429] [levelValue: 900] [[ StandardWrapperValve[MyApplication]: Servlet.service() for servlet MyApplication threw exception java.lang.ClassNotFoundException: org.json.simple.JSONObject
Can someone help me ?
You have to add the library to your Glassfish directory too. Otherwise Glassfish will not find it.
Add the
.jar
file to<GLASSFISH_DIR>\glassfish\domain\domain1\lib
and then restart your Glassfish.