As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

Apache Tomcat is being an asshole, help!

Jimmy KingJimmy King Registered User regular
I have a web app I developed some time ago using Java that runs on Tomcat. It used to work just fine. A couple of months back I had to move to a new server and am just now setting Tomcat back up. It doesn't work anymore. The previous server was Debian 4 using Sun's Java since Tomcat hated gcj. This server is Debian 5 and is using gcj rather than Sun's implementation since Tomcat starts up with no issues using gcj this time. Both servers had Tomcat 5.5.

My app, of course, is exactly the same. I just copied the .war file and let her rip. Tomcat sees it, extracts it with no issues, etc. So I know everything is ok there. The server configuration is also the same. I had just backed up the old config files, so all I had to do was copy and paste the relevent bits of configuration. In case I missed something, I also tried just dropping the entire old server.xml in place.

Unfortunately, when I try to actually access the site, Tomcat is being a dick and says that it can't find my classes no matter what I do. Tomcat does not tell me any sort of local path where it's looking for my classes, just that it can't find the class. Is there any way I can make it tell me where it thinks my classes should be?

First load of a page I get an error like so as the root cause:
java.lang.ClassNotFoundException: games.Archive.WebEngine.Home
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:548)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(libgcj.so.90)

After that, I get the standard Tomcat 404 error stating that the servlet is unavailable.

Server config stuff is as follows:

In my server.xml:
<Host name="games.bash-shell.net" appBase="/home/justin/public_html/games.bash-shell.net/javaWARs" unpackWARs="true">
              <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/tomcat5.5" prefix="games_access_log." suffix=".log" pattern="common" resolveHosts="false"/>
              <Context path="" docBase="WebEngine" debug="0" reloadable="true">
                  <Resource name="jdbc/database" auth="Container" type="javax.sql.DataSource" maxActive="50" maxIdle="5" maxWait="10000" username="REMOVED" password="REMOVED" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/justin_games_beta?autoReconnect=true"/>
              </Context>
 </Host>

As I said previously, Tomcat find the .war file in /home/justin/public_html/games.bash-shell.net/javaWARs and unpacks it properly to /home/justin/public_html/games.bash-shell.net/javaWARs/WebEngine/. All of the classes are there, the app's web.xml is there, etc. That's all in place and is exactly what worked on the old server with the same config.

Any ideas on what I may have missed? Is there a way I can tell Tomcat to tell me what local file path it's looking for my classes in?

Jimmy King on

Posts

  • Options
    Jimmy KingJimmy King Registered User regular
    edited February 2010
    Issue resolved. This can be locked.

    Here's the deal, in case anyone else goes through this.

    1) Debian tries to use gcj with Tomcat. It seems it still doesn't fucking work. It's just less broken since Tomcat will actually start up. Use the real Sun Java stuff.

    2) Once it's up and running, most Java libraries get stuck in /usr/share/java. Unfortunately, Tomcat can't find them there. You need to create symlinks to them in /usr/share/tomcat5.5

    Jimmy King on
Sign In or Register to comment.