0 Replies Latest reply on Mar 11, 2011 7:51 AM by André Almeida

    problem sending an email with javamail

    André Almeida Newbie

      Hi guys,

       

          I have a Web application that is running on my JBOSS server. I use spring 3.0.3 and JBOSS 4.2.3.GA. There is a RPC call that sends e-mails to a user. When I test it in my local machine it works fine, but when I try to send an e-mail after the deploy I get this erro:

       

       

       ERROR [[/webapp]] Exception while dispatching incoming RPC call
      com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String 
      com.webapp.client.rpc.EnviarEmailServiceRpc.enviarEmail(com.webapp.model.Regra,com.webapp.model.Usuario,
      java.lang.String,com.webapp.model.Usuario,java.lang.String) throws com.webapp.exception.WebAppException' 
      threw an unexpected exception: java.lang.IllegalAccessError: tried to access method 
      javax.mail.internet.MimeBodyPart.setText(Ljavax/mail/internet/MimePart;Ljava/lang/String;
      Ljava/lang/String;Ljava/lang/String;)V from class javax.mail.internet.MimeMessage
              at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
              at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
              at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
              at org.gwtrpcspring.RemoteServiceDispatcher.invokeAndEncodeResponse(RemoteServiceDispatcher.java:80)
              at org.gwtrpcspring.RemoteServiceDispatcher.processCall(RemoteServiceDispatcher.java:53)
              at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
              at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at com.webapp.server.servlet.AuthFilter.doFilter(AuthFilter.java:35)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:662)
      
      Caused by: java.lang.IllegalAccessError: tried to access method 
      javax.mail.internet.MimeBodyPart.setText(Ljavax/mail/internet/MimePart;
      Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V from class javax.mail.internet.MimeMessage
              at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1493)
              at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1477)
              at org.springframework.mail.javamail.MimeMessageHelper.setPlainTextToMimePart(MimeMessageHelper.java:847)
              at org.springframework.mail.javamail.MimeMessageHelper.setText(MimeMessageHelper.java:794)
              at org.springframework.mail.javamail.MimeMessageHelper.setText(MimeMessageHelper.java:767)
              at org.springframework.mail.javamail.MimeMailMessage.setText(MimeMailMessage.java:168)
              at org.springframework.mail.SimpleMailMessage.copyTo(SimpleMailMessage.java:197)
              at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:303)
              at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
              at com.webapp.utils.EmailServlet.enviarEmail(EmailServlet.java:27)
              at com.webapp.services.EnviarEmailServiceImpl.enviarEmailFluxo(EnviarEmailServiceImpl.java:72)
              at com.webapp.server.rpc.EnviarEmailServiceRpcImpl.enviarEmail(EnviarEmailServiceRpcImpl.java:16)
              at com.webapp.server.rpc.EnviarEmailServiceRpcImpl$$FastClassByCGLIB$$48d927cb.invoke(<generated>)
              at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
              at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
              at org.gwtrpcspring.gilead.GileadAdapterAdvice.doBasicProfiling(GileadAdapterAdvice.java:53)
              at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
              at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
              at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
              at com.webapp.server.rpc.EnviarEmailServiceRpcImpl$$EnhancerByCGLIB$$9e334cce.enviarEmail(<generated>)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
              ... 29 more
      

       

      I'm using java.mail 1.4.1 and I don't understand whats going on. Can someone help me?

       

      thanks for your time!