使用java工作在netbeans上而不是在tomcat 8

时间:2018-01-26 13:22:50

标签: java email tomcat netbeans

我正在为客户发送电子邮件的webservice工作,我在debian jessie上使用netbeans 8.2作为IDE,avery认为工作得很好,但是当我在vps上部署tomcat8 web服务器上的web服务时     类型异常报告

message Servlet execution threw an exception

description The server encountered an internal error that prevented 
it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger
javax.mail.internet.MailDateFormat.<clinit>(MailDateFormat.java:154)
javax.mail.internet.MimeMessage.<clinit>(MimeMessage.java:177)
dz.GpsTracker.daoe.DAOEGestionEmailsImp.envoyer(DAOEGestionEmailsImp
.java:42)
dz.GpsTracker.servlets.Inscription.doPost(Inscription.java:167)
javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.ClassNotFoundException: com.sun.mail.util.MailLogger
org.apache.catalina.loader.WebappClassLoaderBase.loadClass
(WebappClassLoaderBase.java:1294)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass
(WebappClassLoaderBase.java:1146)
javax.mail.internet.MailDateFormat.<clinit>(MailDateFormat.java:154)
javax.mail.internet.MimeMessage.<clinit>(MimeMessage.java:177)
dz.GpsTracker.daoe.DAOEGestionEmailsImp.envoyer(DAOEGestionEmailsImp.
java:    42)
dz.GpsTracker.servlets.Inscription.doPost(Inscription.java:167)
javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


note The full stack trace of the root cause is available in the 
Apache Tomcat/8.0.14 (Debian) logs.

我没有使用maven
我在/ usr / share / tomcat8 / lib /上复制java.mail
我在/ var / lib / tomcat8 / webapps / mywebservice / WEB-INF / classes / dz / mywebservice / lib /上的java.mail
我在java.mail jar上使用了chmod 777
我是javax.mail-api-1.6.0.jar和mail.jar

1 个答案:

答案 0 :(得分:1)

问题是jEE中存在com.sun.mail.util.MailLogger,对于netbeans可以运行它,但不是tomcat 解决方案是添加javax.mail-1.5.0.jar,你可以很好地发送电子邮件