MazWoz / jsmpp

Automatically exported from code.google.com/p/jsmpp
Apache License 2.0
0 stars 0 forks source link

NullPointerException when sending an SMS from a Servlet. #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm trying to execute the SimpleSubmitExample code from within a Servlet,
and get the following excetion: 

java.lang.NullPointerException
        at org.jsmpp.DefaultPDUSender.sendSubmitSm(DefaultPDUSender.java:196)
        at
org.jsmpp.SynchronizedPDUSender.sendSubmitSm(SynchronizedPDUSender.java:192)
        at
org.jsmpp.session.SubmitSmCommandTask.executeTask(SubmitSmCommandTask.java:86)
        at
org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:248)
        at
org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:318)
        at
com.deimos.opentcp.server.sms.sender.SMSSenderServlet.processRequest(SMSSenderSe
rvlet.java:96)
        at
com.deimos.opentcp.server.sms.sender.SMSSenderServlet.doGet(SMSSenderServlet.jav
a:139)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:206)
        at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.jav
a:390)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:235)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
33)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
91)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109
)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Pr
otocol.java:583)
        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)

The example works fine executing as a standalone application, but in this
case within a Servlet it fails, I don't know why. 

Have you tested the API in a servlet environment? Is there something I must
take into account? 

Thanks in advance. 

--
Félix.

Original issue reported on code.google.com by felix.pedrera on 21 Jan 2009 at 8:14

Attachments:

GoogleCodeExporter commented 8 years ago
Which version did you use?

Original comment by uuda...@gmail.com on 22 Jan 2009 at 4:54

GoogleCodeExporter commented 8 years ago
I am using jsmpp 2.0. I have tested deploying the web application on tomcat 6 
and
Glassfish v2, under jvm 1.6. I get the same exception in both cases. 

Original comment by felix.pedrera on 22 Jan 2009 at 6:55

GoogleCodeExporter commented 8 years ago
Hi, 

You should specify the RegisteredDelivery when submitting short message.
Just replace the similar line with this:

String messageId = session.submitShortMessage("CMT", TypeOfNumber.UNKNOWN, 
NumberingPlanIndicator.PRIVATE, "2342", TypeOfNumber.NATIONAL, 
NumberingPlanIndicator.ISDN, "666326598", new ESMClass(), (byte)0, (byte)0,  
null, 
null, new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE), (byte)0, new 
GeneralDataCoding(false, true, MessageClass.CLASS1, Alphabet.ALPHA_DEFAULT), 
(byte)0, 
"Test".getBytes());

That should fix the problem.

Original comment by uuda...@gmail.com on 23 Jan 2009 at 3:24