Wow, has it really been that long since I've asked questions here? On to
the meat and potatoes...
I have a tomcat 5.5.23 installation here that I am trying to do some
changes too and I am a bit lost.. Let me try to explain what I want to
do. The application has both a context defined in the server.xml and in
the context.xml file in the META-INF directory. I've currently removed the
context in the server.xml and moved it into it's own context.xml file.
I have removed all context references in the server.xml so it looks like
this now <minus the server name for obvious reasons>:
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer"
value="30"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true" />
<Engine name="Catalina" defaultHost="server.com" debug="0">
<Host name="server.com" debug="0" appBase="webapps"
deployOnStartup="true" unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false" />
</Engine>
</Service>
</Server>
It's pretty simple and elegant. Not hard to follow. So in my project,
I've created a META-INF/context.xml file with the following declaration:
<Context>
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://dbreader/.."
connectionName="emr_jsp"
connectionPassword="....."
userTable="TomcatUsers"
userNameCol="UserID"
userCredCol="Password"
userRoleTable="TomcatUserRoles"
roleNameCol="RoleID"
digest="MD5"/>
<Manager className="org.apache.catalina.session.PersistentManager"
saveOnRestart="true" distributable="true">
<Store className="org.apache.catalina.session.FileStore"
directory="/tmp/tc_sessions/"/>
</Manager>
</Context>
again, not hard to follow. this project is packaged up in the WebEMR.war
and resides under the $CATALINA_HOME/webapps/billing-1.0.4 directory
I have deleted everything under the $CATALINA_HOME/work directory and also
the $CATALINA_HOME/conf/[Engine] directory. The war successfully builds,
and I had it deploys with the server.xml configuration below, when the
contexts are defined within it. According to the docs, your supposed to
remove the path="" and docBase="" attributes from the new context
declaration within the context.xml file, so I have done that. When I start
up tomcat, nothing outputs to catalina.out, so I attached log4j to the
server and I get this little gem of a message:
DEBUG ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.startup.HostConfig - Checking context[/billing-1.0.4]
redeploy resource /opt/tomcat/webapps/billing-1.0.4/META-INF/context.xml.
There's something missing there.... it appears that the WebEMR.war is not
being deployed and it is looking for the files at the billing-1.0.4
directory. I've got to be missing something, but for the life of me I
cannot figure out what it is. Can someone give me some insight please?
This is the working server.xml file. With this one, the WebEMR.war is
sitting in $CATALINA_HOME/webapps/billing-1.0.4/. It deploys out to
$CATALINA_HOME/webapps/1.0.4
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer"
value="30"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true" />
<Engine name="Catalina" defaultHost="server.com" debug="0">
<Host name="server.com" debug="0" appBase="webapps"
deployOnStartup="true" unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path="/1.0.4"
docBase="billing-1.0.4/WebEMR">
<Realm
className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://dbwriter/"
connectionName="tclogin"
connectionPassword="shhhhhh"
userTable="TomcatUsers"
userNameCol="UserID"
userCredCol="Password"
userRoleTable="TomcatUserRoles"
roleNameCol="RoleID"
digest="MD5">
</Realm>
</Context>
</Host>
</Engine>
</Service>
</Server>
Warmest regards and thanks in advance!
- Josh