File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes wierd exception - please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "wierd exception - please help" Watch "wierd exception - please help" New topic
Author

wierd exception - please help

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hi;
i have deployed jforum into my production environment . after a short while where the forum works, the exception below appears and the forum cannot be used anymore.

my env is unix, java 1.4.2_04, tomcat 5.0.30, connector-j 3.0.15, jforum 2.0.2

any help or ideas would be appreciated.


stack trace:
23:22:36,389 ERROR [ForumException ] 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:88)
at net.jforum.JForum.service(JForum.java:262)
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 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: Communication link failure: java.io.EOFException, underlying cause: null

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1394)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1538)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2247)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
at net.jforum.drivers.generic.ForumModel.getLastPostInfo(ForumModel.java:330)
at net.jforum.repository.ForumRepository.getLastPostInfo(ForumRepository.java:193)
at net.jforum.view.forum.ForumAction.getAllForums(ForumAction.java:129)
at net.jforum.view.forum.ForumAction.list(ForumAction.java:164)
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:88)
at net.jforum.JForum.service(JForum.java:262)
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 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)


** END NESTED EXCEPTION **


at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1713)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2247)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
at net.jforum.drivers.generic.ForumModel.getLastPostInfo(ForumModel.java:330)
at net.jforum.repository.ForumRepository.getLastPostInfo(ForumRepository.java:193)
at net.jforum.view.forum.ForumAction.getAllForums(ForumAction.java:129)
at net.jforum.view.forum.ForumAction.list(ForumAction.java:164)
... 33 more
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
What is "short while"? It looks like your server is discarding mysql connections very quickly. This problem usually occurs when using connection pools under some configurations.

One solution is to edit WEB-INF/config/SystemGlobals.properties ( or WEB-INF/config/<username>.conf ) and change the value of the key database.driver.implementation to "net.jforum.SimpleConnection".

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Well, using net.jforum.SimpleConnection will not be a performance problem. I have a very large forum running with simple connectins because the 15 seconds timeout the ISP imposed over the connections, and it runs very well.

However, if you want, you can get connections from a datasource ( eg, using Tomcat managed connections ).

I have made a DataSourceConnection class. Get it at

https://jforum.dev.java.net/source/browse/jforum/src/net/jforum/DataSourceConnection.java?rev=1.1&content-type=text/vnd.viewcvs-markup

In this file, change the call



to have your datasource name hardcoded, since the jforum available to download doesn't have the DATASOURCE_RESOURCE_NAME config option. If will looks like



Then compile and put in WEB-INF/classes/net/jforum directory. The last step you should made is to edit WEB-INF/config/SystemGlobals.properties and change the key "database.driver.implementation" to "net.jforum.DataSourceConnectionn".

But if you don't like this, then just use net.jforum.SimpleConnection .

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hi and thanks for the reply;
a short while could be 2 minutes...
how would simple connection will affect performance?

in my site i have 2 apps deplyed on tomcat, one of them is jforum.
in my other app (not jforum) i use 2 connection pools configured as tomcat resources.
one of the pools goes to jforum DB (this is besides jforum connection pool) because when a user registers to my site i register him to the forum also.

what would you suggest as steps to try and resolve the problem?

(i now deleted jars such as connector-j, mail,activation etc.. from the jforum web-inf/lib cause they already exist in the tomcat common/lib - and are advised by tomcat documentation to be there.)

thanks.
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
thanks;
i intended to implement a DS connection - you saved me the time.
only one question about it.
i noticed you do a JNDI lookup for each call to the getConnection method. is this because if the way jforum uses the class(new instace for each connection) or can i put it as a member variable and initialize it from the init method (as jndi lookups are considered expensive)
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
So, that's a good point.

I put the lookup method in getConnection() just becaue I didn't know how expensive it was and if I could make the DataSource a instance member.

There is only one instance in memory, controlled by net.jforum.DBConnection.

So, if there is no problem to have the DataSource as membe of the class, I'll change the code fo act this way.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hi;
well, i did the following and now things seem to work.

i upgraded the connector-j version (i dont think thats the reason)

i had to 2 apps each with a <context> scoped tomcat configured DS to the jforum DB.

i remove the context scope DS from both apps moving the DS declaration to the tomcat global resources section.

now both apps use the same DS config.
i also added the DS DBConnection implementation rafael suggested (but moving the lookup part to the init method)

now it looks like the exceptions are gone.

thanks for the help/
[originally posted on jforum.net by gkatz]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Great!!! I updated the DataSourceConnection class in the CVS, to have the DataSource as a member of the class.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wierd exception - please help