while working with java mail in jsp - java

I used the code from here
I am following it as it is, but while executing I got errors as below
2014-03-06 16:27:33,203 - [SMTPSender] SMTPSender - Delivery failed for message from: nbarath2008#gmail.com to: nbarath2008#gmail.com - java.lang.RuntimeException: SMTP Response too short. Aborting Send. Response:
java.lang.RuntimeException: SMTP Response too short. Aborting Send. Response:
at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.read(SMTPRemoteSender.java:380)
at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendIntro(SMTPRemoteSender.java:270)
at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendMessage(SMTPRemoteSender.java:122)
at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliverRemoteMessage(SMTPSender.java:361)
at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliver(SMTPSender.java:184)
at com.ericdaugherty.mail.server.services.smtp.SMTPSender.run(SMTPSender.java:100)
at java.lang.Thread.run(Thread.java:744)`
Please guide me, thank you.

Related

Jersey, An I/O error has occurred while writing a response message

I use SpringBoot and Jersey into my project and I often tackle the following error :
[ERROR - ServerRuntime$Responder - 2018-02-13 13:16:45,983] An I/O error has occurred while writing a response message entity to the container output stream.
org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
It results with a 503 status response to my client.
Could you explain me why this error occured ?
Thanks
This kind of error usually happens servlet is writing data back on the stream and connection closed from client side.
It is like server in sending some data may be file, string, bytes etc.. but on client side like a browser has closed the connection, like you close the browser tab.
It cased early End of file exception on the server.
I have had this exception when I accidentally passed a null Response at the end of a call. You can verify this in the'caused by' section following the first exception:
Caused by: org.eclipse.jetty.io.EofException: null

camel : Unable to read BODYSTRUCTURE

I am using Apache Camel mail to read emails from an account. But for a particular mail, it is stuck over there and throws an exception as "Unable to read BODYSTRUCTURE" . It also does not mark the mail as read. Any mail received after that are not read by the camel service.
317422 [Camel (emailToEWSContext) thread #0 - imaps://outlook.office365.com] WARN org.apache.camel.component.mail.MailConsumer - Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract body due to: Unable to load BODYSTRUCTURE. Exchange: Exchange[][MailMessage#0x55f69873]. Message: com.sun.mail.imap.IMAPMessage#7a97bfa9]
org.apache.camel.RuntimeCamelException: Failed to extract body due to: Unable to load BODYSTRUCTURE. Exchange: Exchange[][MailMessage#0x55f69873]. Message: com.sun.mail.imap.IMAPMessage#7a97bfa9 at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:275)

MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException

I try to send an email using javaMail, spring-boot and yahoo. I got this SMTPSendFailedException and I don't know why.
Here a part of the exception:
ErrorPageFilter: Forwarding to error page from request [/registration] due to exception [Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
]
org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
; message exception details (1) are:
Failed message 1:
com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2203)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1694)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1194)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:433)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1703)
... 102 more
[2015-10-27 22:11:14.252] boot - 8407 DEBUG [http-nio-8080-exec-8] --- EndpointHandlerMapping: Looking up handler method for path /error
[2015-10-27 22:11:14.257] boot - 8407 DEBUG [http-nio-8080-exec-8] --- EndpointHandlerMapping: Did not find handler method for [/error]
The Email config properties, I use yahoo as host:
spring.mail.host=smtp.mail.yahoo.com
spring.mail.port=465
spring.mail.username=*****#yahoo.com
spring.mail.password=*****
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.ssl.enable=true
The part of the implementation which send the email;
#Autowired
JavaMailSender javaMailSender;
String recipientAddress = XXXX.getUser().getEmail();
String subject = "Bienvenue chez AAAA";
String message = "huhuu";
SimpleMailMessage email = new SimpleMailMessage();
email.setTo(recipientAddress);
email.setSubject(subject);
email.setText(message + "\n");
javaMailSender.send(email);
Can someone help me?
What version of JavaMail are you using? Can you capture the debug output? The mail server is complaining about the SMTP MAIL FROM command, which probably means the From address of your message isn't set correctly. Since you don't seem to be setting it explicitly, perhaps SimpleMailMessage is choosing a default that's bad? Setting it explicitly to a legal value will probably solve the problem.

Error after installing mod_xmlrpc in ejabberd

I am working on a java project in which i have to communicate with the ejabberd (create/delete a jabber user etc.. ) xmpp server. From the different suggestions available in the internet I understood that xml rpc one method to achieve that.
I tried to install the mod_xmlrpc as per the suggesions in this thread. Error while starting ejabberd with xml_rpc
But I had failed to start the ejabberd after configuration of mod_xmlrpc. The ejabberd log says,
=ERROR REPORT==== 2015-03-15 20:23:27 ===
C(<0.42.0>:gen_mod:75) : Problem starting the module mod_adhoc for host "example.com"
options: []
exit: {noproc,
{gen_server,call,
[ejabberd_iq_sup,
{start_child,["example.com",mod_adhoc,process_local_iq]},
infinity]}}
=ERROR REPORT==== 2015-03-15 20:23:27 ===
C(<0.42.0>:gen_mod:80) : ejabberd initialization was aborted because a module start failed.
and the erlang log says,
=CRASH REPORT==== 15-Mar-2015::20:23:27 ===
crasher:
initial call: supervisor:ejabberd_listener/1
pid: <0.270.0>
registered_name: []
exception exit: {undef,
[{ejabberd_xmlrpc,socket_type,[],[]},
{ejabberd_listener,'-bind_tcp_ports/0-fun-0-',1,
[{file,"ejabberd_listener.erl"},{line,63}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
{ejabberd_listener,init,1,
[{file,"ejabberd_listener.erl"},{line,52}]},
{supervisor,init,1,
[{file,"supervisor.erl"},{line,239}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
in function gen_server:init_it/6 (gen_server.erl, line 328)
ancestors: [ejabberd_sup,<0.42.0>]
messages: []
links: [#Port<0.3747>,<0.234.0>,#Port<0.3744>]
dictionary: []
trap_exit: true
status: running
heap_size: 987
stack_size: 27
reductions: 1215
neighbours:
=SUPERVISOR REPORT==== 15-Mar-2015::20:23:27 ===
Supervisor: {local,ejabberd_sup}
Context: start_error
Reason: {undef,
[{ejabberd_xmlrpc,socket_type,[],[]},
{ejabberd_listener,'-bind_tcp_ports/0-fun-0-',1,
[{file,"ejabberd_listener.erl"},{line,63}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
{ejabberd_listener,init,1,
[{file,"ejabberd_listener.erl"},{line,52}]},
{supervisor,init,1,[{file,"supervisor.erl"},{line,239}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
Offender: [{pid,undefined},
{name,ejabberd_listener},
{mfargs,{ejabberd_listener,start_link,[]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
Since I am a newbie to the ejabberd & erlang world I am finding it hard to track the root cause. Please help me to identify the root cause of this crash.
BTW is there any other method for communicating with ejabberd (create/delete a jabber user etc..) from java services ?
The erlang log says that it can't find the function socket_type with no argument in the module ejabberd_xmlrpc. As it is a valid call, and both the module and function exist in the application ejabberd, this means that something went wrong during installation (compilation fails, wrong path ???)

NestedRuntimeException: Cannot parse POST parameters of request

As part of an application, we have a JSP page (parent page) in which we are calling another JSP page (child page), where all the parameters of the child page has been assigned to the form of the parent page and then trying to submit the page.
At the time of submission, we are getting the following error on the frontend...
(I) Front end error
=====================
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
And on the backend we get the following error...
(II) Application server Error log
<Error> <HTTP> <BEA-101019> <[ServletContext(id=29607640,name=test,c
ontext-path=/Test)] Servlet failed with IOException
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at weblogic.servlet.internal.PostInputStream.read(PostInputStream.java:170)
at weblogic.servlet.internal.ServletInputStreamImpl$1.read(ServletInputStreamImpl.java:115)
at weblogic.servlet.internal.ServletInputStreamImpl.read(ServletInputStreamImpl.java:180)
at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletRequestImpl.java:1339
)
at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(ServletRequestImpl.java:120
6)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java:1409)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:39
02)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
**--------------- nested within: ------------------
weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request: '/Test/test1.jsp
' - with nested exception:
[java.net.SocketTimeoutException: Read timed out]**
at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletRequestImpl.java:1364
)
at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(ServletRequestImpl.java:120
6)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java:1409)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:39
02)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Could you please offer a suggestion as to the cause of the problem.
You are getting a SocketTimeoutException, so there is probably something wrong with your POST. For example, you might not be sending through enough bytes of data, or you might not be closing off the connection once you're finished with it - basically its sitting there waiting for more information until it eventually times out.
Could you please post some of your JSP code, especially where you're creating and running your POST, so that we can provide some better feedback.

Categories

Resources