[英]Glassfish cannot find imported class
I have a small webservice program in which I need to import JSONObject from external jar. 我有一个小的网络服务程序,需要从外部jar导入JSONObject。 While trying to deploy the webservice, the Glassfish couldn't find the imported class (from external jar), but things look fine in IDE. 尝试部署Web服务时,Glassfish找不到(从外部jar)导入的类,但是在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 [2017-11-17T16:22:49.429 + 0100] [glassfish 4.1] [警告] [] [javax.enterprise.web] [tid:_ThreadID = 30 _ThreadName = http-listener-1(1)] [timeMillis:1510932169429 ] [levelValue:900] [[StandardWrapperValve [MyApplication]:Servlet MyApplication的Servlet.service()引发了异常java.lang.ClassNotFoundException:org.json.simple.JSONObject
Can someone help me ? 有人能帮我吗 ?
You have to add the library to your Glassfish directory too. 您也必须将库添加到Glassfish目录中。 Otherwise Glassfish will not find it. 否则,玻璃鱼将找不到它。
Add the .jar
file to <GLASSFISH_DIR>\\glassfish\\domain\\domain1\\lib
and then restart your Glassfish. 将.jar
文件添加到<GLASSFISH_DIR>\\glassfish\\domain\\domain1\\lib
,然后重新启动Glassfish。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.