Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Tomcat blocks JSP Bean connection

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a JSP bean running in apache Tomcat 7.0.26. This bean opens a connection to a Java server running in the same machine, and sends/receives data, passing it to a JSP page
It works fine, but when I define a security constraint in web.xml, and set a user login and password in tomcat-users.xml, connection blocks the stack trace:

java.lang.NullPointerExceptionRun started at test.NetBean.send(NetBean.java:68)
org.apache.jsp.tele_jsp._jspService(tele_jsp.java:93)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
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)

Thanks in advance
 
Sheriff
Posts: 22644
123
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd start with investigating what's on line 68 of class test.NetBean. That's where the NPE originates from.

If that's not the cause of the problem because an invalid argument is passed to this method, you should check out class org.apache.jsp.tele_jsp. This is an automatically generated class based on your tele.jsp file. You can find its source in <TOMCAT>\work\Catalina\localhost\<WEBAPP>. Check out line 93 and try to trace it back to your original JSP file.
 
tsa tham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:I'd start with investigating what's on line 68 of class test.NetBean. That's where the NPE originates from.

If that's not the cause of the problem because an invalid argument is passed to this method, you should check out class org.apache.jsp.tele_jsp. This is an automatically generated class based on your tele.jsp file. You can find its source in <TOMCAT>\work\Catalina\localhost\<WEBAPP>. Check out line 93 and try to trace it back to your original JSP file.



Hi,
thanks for your replay the method in line 93 witch related to test.NetBean work fine before I Define a Security Constraint on this Application in tomcat to protect some pages when I comment that in web.xml and tomcat-users.xml then it work fine and the bean open connection and send/received data from the server , only after Security Constraint defined in tomcat the problem occurs and the bean open connection but when the method net.send() try to send data an exception thrown .
 
Rob Spoor
Sheriff
Posts: 22644
123
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But did you check why the NullPointerException is thrown? Exceptions always have a reason, you just need to find it. By looking at the two locations I hinted at you should be able to get further.
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic