Web Hosting Talk







View Full Version : Register an app with Tomcat


DavidV
06-28-2007, 12:55 PM
Hey everyone, how do you register an app with Tomcat? My site is in java and I want to install a java forum. I need to register it with Tomcat though.

Thanks in advance.

stdunbar
06-28-2007, 01:05 PM
Hey everyone, how do you register an app with Tomcat? My site is in java and I want to install a java forum. I need to register it with Tomcat though.

Thanks in advance.

I'm not sure what you mean. In Tomcat there are a few ways of running a web application. The simplest way is to put it in the webapps directory of the Tomcat install. In that case though you will have to access your forum with a prefix. So, for example, if you put your forum in $CATALINA_BASE/webapps/forum then you will access your forum at http://hostname:8080/forum (by default).

However, there are other ways of doing this too. You could define a virtual host with a context that points to your directory. That would allow you to skip the /forum part of the URL but it requires other things like getting DNS setup correctly.

Can you provide a bit more detail on what it is you're trying to do? Are you doing this via a control panel or by hand?

DavidV
06-28-2007, 01:10 PM
I'm using cPanel. My site is running under the "apps" directory. Beneath it I did create a Forum directory.

Here is the error message I get when trying to access the url which has the install file:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet jforum threw exception
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:691)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
org.apache.jsp.forum.jforum.install_jsp._jspService(install_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

net.jforum.exceptions.ForumStartupException: Error while starting jforum
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
net.jforum.dao.generic.GenericCategoryDAO.selectAll(GenericCategoryDAO.java:104)
net.jforum.repository.ForumRepository.loadCategories(ForumRepository.java:782)
net.jforum.repository.ForumRepository.start(ForumRepository.java:128)
net.jforum.ForumStartup.startForumRepository(ForumStartup.java:100)
net.jforum.JForum.init(JForum.java:114)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:691)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
org.apache.jsp.forum.jforum.install_jsp._jspService(install_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
Apache Tomcat/5.0.30

Burhan
06-28-2007, 01:18 PM
Seems like a permissions issue with SQL?

DavidV
06-28-2007, 01:40 PM
Does it? Do you think perhaps I entered the wrong database name/user/password?

stdunbar
06-28-2007, 02:53 PM
Yes, I would agree with fyrestrtr. Specifically you have:


com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)


which means that the JDBC driver is creating an Exception to be thrown. I would take a look at the Tomcat error logs as they may have more information. JForum is developed on MySQL so it should work on there with no issues.

DavidV
06-28-2007, 04:26 PM
I checked the database settings and they all seem to be set properly. I had read somewhere on JForum's site that the "app has to be registered with Tomcat". I looked for further information, but couldn't find it.

Basically, it seems that I have to let Tomcat know to also run JForum.

Biju
06-28-2007, 04:42 PM
Take a look at this and tell me if it did help you.

http://www.jajakarta.org/tomcat/tomcat3.2-4.0/tomcat-3.2.3/doc/appdev/source.html


Basically ,

The registration of servlets is done by editing your .WAR file (or exploded .WAR file)'s WEB-INF/web.xml file, putting in the appropriate <servlet> and <servlet-mapping> tags.

stdunbar
06-28-2007, 05:07 PM
Perhaps you need to start with some very basic web applications before jumping into JForum.

As I stated above, there isn't a registration process per se. There are two common ways that Tomcat runs a Java EE web app - as a virtual host or as a Context element within a virtual host.

If you do not have permission to modify your $CATALINA_HOME/conf/server.xml or add Context elements under the Tomcat conf directory then you will not be able to accomplish what you want.

Again, what did the Tomcat error logs have? If you don't know where they're at then you may want to back up a bit before installing a large Java EE application like a forum. It isn't hard but some basic debugging techniques may need to be used.

I checked the database settings and they all seem to be set properly. I had read somewhere on JForum's site that the "app has to be registered with Tomcat". I looked for further information, but couldn't find it.

Basically, it seems that I have to let Tomcat know to also run JForum.

JForum already ships as a webapp with the correctly configured web.xml. It cannot run as a war file.


The registration of servlets is done by editing your .WAR file (or exploded .WAR file)'s WEB-INF/web.xml file, putting in the appropriate <servlet> and <servlet-mapping> tags.