Apache Roller 4.0 fixing java.io.EOFException
As I have been trying to fix performance issues with my Apache Roller site, I decided to take a look at the roller.log file to see if I came across anything strange. Of course that was a pretty good place to start, as a issue seemed to raise it ugly little head.
I noticed that I was getting a huge error in the log that seemed to happen about ever day. The error was a java.io.EOFException that seemed to be a nested exception of the Open JPA ~PersistenceException. It appears that this issue is related to database connections not being available to the persistence engine, and is having a hard time reconnecting to the database. This would totally explain my issue, since it was appearing that it was taking a long time for data to be retrieved from the database.
To fix this, I changed my Apache Roller installation in Tomcat 5.5 to do jndi database lookups and the standard jdbc database connections. To do this you change the jdbc connect configuration in your roller-custom.properties file from this:
database.configurationType=jdbc database.jdbc.driverClass=JDBC driver class name] database.jdbc.connectionURL=JDBC connection URL database.jdbc.username=database username database.jdbc.password=database password
to
database.configurationType=jndi database.jndi.name=jdbc/rollerdb
Now you will have to setup your database resources in a context configuration file. This can be done by editing the file in your context.xml file in the rollers applicaiton META-INF directory. It is important to note that this exception is related to connections not being reconnected correctly. Since I have a ~MySQL Database the autoReconnect=true setting is necessary to fix this error. Here is a example of what what the context.xml file looks like. I got this example from the rolle-installion-guide.pdf
<Context path="/roller"
docBase="/usr/local/apache-roller-4.0/webapp/roller" debug="0">
<Resource name="jdbc/rollerdb" auth="Container" type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8"
username="scott"
password="tiger"
maxActive="20" maxIdle="3" removeAbandoned="true" maxWait="3000" />
<Resource name="mail/Session" auth="Container" type="javax.mail.Session"
mail.smtp.host="mailhost.example.com" />
</Context>
Now that I have made these changes the Roller Application is runner better than ever before.



