Win a copy of Emmy in the Key of Code this week in the General Computing 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

java.lang.reflect.InvocationTargetException (another one)

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I randomly get java.lang.reflect.InvocationTargetException
12:36:47,532 INFO [SessionFacade ] Removing session 4C5D17930C80CEE5A2A5086AC483D485
12:36:47,538 ERROR [ExceptionWriter ] java.lang.reflect.InvocationTargetException
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:324)
at net.jforum.Command.process(Command.java:113)
at net.jforum.JForum.service(JForum.java:176)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at net.jforum.entities.UserSession.<init>(UserSession.java:90)
at net.jforum.view.forum.UserAction.validateLogin(UserAction.java:332)
... 24 more


[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
relevant part of the trace:

Caused by: java.lang.NullPointerException
at net.jforum.entities.UserSession.<init>(UserSession.java:90)
at net.jforum.view.forum.UserAction.validateLogin(UserAction.java:332)

this seems to be happening when session is expired or web server is restared
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ThreadLocal should not impact in performance - there are really busy sites running jforum, and synchronization is not a problem at all, since it's realy really fast in modern virtual machines.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a quick "fix" to this NPE problem, but didn't tested it at all. You can get UserAction.java from the cvs and take a look.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He will probably need to know which version of JForum you are running, if downloaded from CVS which version of those files you have, and servlet container model and version would probably also help.

Some servlet containers behave a bit strangely when timing out sessions, like removing everything inside the session before notifying the application that the session expired, so this information is quite important.


[originally posted on jforum.net by GreenEyed]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

GreenEyed wrote:He will probably need to know which version of JForum you are running, if downloaded from CVS which version of those files you have, and servlet container model and version would probably also help.

Some servlet containers behave a bit strangely when timing out sessions, like removing everything inside the session before notifying the application that the session expired, so this information is quite important.



I am using the latest JForum version from CVS.
Servlets - tomcat/jakarta-tomcat-5.5.9
I have seen this problem for a while. Only now (in the posting above) I was able to find the cause.


Also, not directly related to this bug, but just a matter of JForum style.
I really dislike all these static methods calls
JForum.getRequest().getContextPath()
JForum.setThreadLocalData()

Because they causes a lot of locking (which is often hard to get right),
races, overall slowdond and etc.
I would much prefer to take the request (ActionServletRequest.java)
extend it and put all the data there.
Then use request variable as first argument of all methonds.

And bingo - you can access all the data you need (it is in ActionServletRequest now)
without any DataHolder, locking, threads and etc.
You have request as argument and just do
request.getUserSession()
request.getContextPath()
No locking at all!


[originally posted on jforum.net by Anonymous]
 
Shiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!