Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumspublish exception issue
https://www.eclipse.org/forums/index.php/mv/msg/486053/1053266/#msg_1053266
since yesterday I have this publish-exception in my java software (paho based) on tomcat:
MqttException (0) - java.io.FileNotFoundException: /Library/apache-tomcat-7.0.11/bin/applicationStatus6-tcp9524030961883/s-2.msg (No such file or directory)
at org.eclipse.paho.client.mqttv3.MqttDefaultFilePersistence.put(MqttDefaultFilePersistence.java:176)
at org.eclipse.paho.client.mqttv3.internal.ClientState.send(ClientState.java:397)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.internalSend(ClientComms.java:81)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:118)
at org.eclipse.paho.client.mqttv3.MqttTopic.publish(MqttTopic.java:62)
at com.integra.application.command.ApplicationCommand.publish(ApplicationCommand.java:47)
at com.integra.applicationCredit.ApplicationCredit.setCredit(ApplicationCredit.java:30)
at com.integra.servlet.ApplicationCreditListener.doPost(ApplicationCreditListener.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.FileNotFoundException: /Library/apache-tomcat-7.0.11/bin/applicationStatus6-tcp9524030961883/s-2.msg (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at org.eclipse.paho.client.mqttv3.MqttDefaultFilePersistence.put(MqttDefaultFilePersistence.java:163)
the folder applicationStatus6-tcp9524030961883 (where applicationstatus6 it's the client-id) doesn't exist, if I make it manually the application works.
It's strange because i hadn't this error before.
Of course when I restart the connection the framework deletes the folder. could be a permissions problem?
How can I fix it?
thanks
marco
]]>marco divita2013-05-03T13:01:52-00:00Re: publish exception issue
https://www.eclipse.org/forums/index.php/mv/msg/486053/1053272/#msg_1053272
It seems like a permissions issue in creating the directory.
You said you created the directory and then it worked; were you able to create it as the same user tomcat runs as, or did you have to use root?
You could tell the client to use a different directory entirely for the persistence data by:
1. create your own instance of MqttDefaultFilePersistence passing in your desired directory to the constructor
2. pass this instance of persistence to the appropriate MqttClient constructor.