tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com>
Subject Re: Fwd: unable to start web application in tomcat-solaris, same works in tomcat-windows
Date Wed, 02 Oct 2013 18:46:33 GMT
Sigh, I got two messages, and I replied to the wrong one (so it didn't 
go to the list).

Please folks, if you're responding to someone on the list keep it on the 
list unless there's a request to go off-list.

Others benefit from the dialogue, and people don't get their mailboxes 
cluttered with extra mail.

And people like me don't make bone-headed reply mistakes . . . .

And now, a copy-paste from my other message:

Some replies in line below.

Also, no need to reply to both me and the list - I'll just get two copies.

BTW - thanks very much for the additional information. Hopefully I'll 
have some useful suggestions.


On 10/2/2013 10:11 AM, Ravi Shankar wrote:
 > Hi there,
 > Please find my responses below.
 >
 > Additionally after I start tomcat7 for application, jar files does 
not seem
 > to get loaded per *log* file contents & additionally im unable to access
 > application @ 
http://<ipaddress:port#>/client_app<http://10.52.32.102:25170/svuivr>.
 >
 >
 > Are there vast differences in the way we deploy tomcat applications in
 > windows & in solaris environments?
 >

No, Tomcat is Tomcat is Tomcat. We use the same mechanism when we deploy 
on Windows, Macintosh, Linux (CentOS, Fedora).

 > Request your suggestions.
 >
 > Thanks
 > Rav
 >
 >
 >> ________________________________
 >> From: Ravi Shankar <ravishankar356ATgmail.com>
 >> To: users <users@tomcat.apache.org>
 >> Sent: Tuesday, October 1, 2013 9:13 PM
 >> Subject: Fwd: unable to start web application in tomcat-solaris, same
 > works in tomcat-windows
 > [Quoted text hidden]
 > Ravi,
 >
 > I don't have a lot of suggestions, but I do have a lot of questions.
 >
 > 1. What is the exact version of Tomcat 7?
 > 7.0.26
 >

I know it's not your environment, but upgrading would be a good idea. 
The latest 7.0 version is 7.0.42.

 > 2. What is the exact version of Java that you are running?
 > *# java -version*
 > java version "1.6.0_43"
 > Java(TM) SE Runtime Environment (build 1.6.0_43-b01)
 > Java HotSpot(TM) Server VM (build 20.14-b01, mixed mode)
 >

Again, I know it's not your environment, but unless they have a support 
contract with Oracle, Java 6 is no longer supported.

However, neither of these issues are the cause of your challenges.

 > 3. What are specific examples of some errors you are encountering?
 >     Please include actual log entries, and not summations.
 >
 > i tried to deploy .WAR files to my windows tomcat and ftp'ed the contents
 > of webapps folder(client_application) into application directory in 
solaris
 > and started tomcat application, and i get below errors on .out log file.
 >
 > *<logfile>.out details below:*
 >
 > Oct 02, 2013 11:14:08 AM org.apache.catalina.startup.SetAllPropertiesRule
 > begin
 > WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting
 > property
 > 'maxSpareThreads' to '64' did not find a matching property.

This is a warning, and means that this property set on the Connector is 
ignored. It appears that they've mixed attributes from the Executor 
element with the Connector element.

However, this probably points out that they've modified the stock 
server.xml quite a bit. More problems below . . .

 > Oct 02, 2013 11:14:08 AM
 > org.apache.tomcat.util.digester.SetPropertiesRule
 > begin
 > WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context}
 > Setting
 > property 'debug' to '0' did not find a matching property.

There is no attribute debug, and placing contexts in server.xml is 
strongly discouraged.

Again, neither of these issues would prevent your application from loading.

 > Oct 02, 2013 11:14:09 AM org.apache.coyote.AbstractProtocol init
 > INFO: Initializing ProtocolHandler ["http-bio-25170"]
 > Oct 02, 2013 11:14:09 AM org.apache.catalina.startup.Catalina load
 > INFO: Initialization processed in 1127 ms
 > Oct 02, 2013 11:14:09 AM org.apache.catalina.core.StandardService
 > startInternal
 > INFO: Starting service <client_app>
 > Oct 02, 2013 11:14:09 AM org.apache.catalina.core.StandardEngine
 > startInternal
 > INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
 > Oct 02, 2013 11:14:09 AM org.apache.catalina.core.StandardContext
 > postWorkDirectory
 > WARNING: Failed to create work directory
 > [/work/tomcat/<client_app>/v1.0/work/<client_app>/localhost
 > /work_tomcat_<client_app>]
 > for context [/work/tomcat/<client_app>]

Now this one is a serious problem. I'm surprised it's only a WARNING 
(not SEVERE - but see below). I'm not sure I can even understand what's 
going on with this directory mess.

Let me see if I can try . . . braver folks than I should probably wade in.

A context is a single web application within a Tomcat servlet container. 
The name of the context is taken from a variety of places, following 
rules stated here:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming

So in order to get the context that you've shown in your log, you would 
have had to name the directory:

work#tomcat#client_app

I doubt you've named your directory in this fashion.

This directory would then be placed in Tomcat's appBase, defined in 
server.xml.

Now what Tomcat is trying to do is to create a work directory where it 
can (among other things) compile JSP pages. It's very unusual to have 
this inside your web application, and I have no idea what happens if the 
intervening directories don't exist.

Apparently as a part of the context they defined in server.xml, they 
specified a workDir. See the following for an explanation:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

It's the last attribute in the standard implementation list.

So it looks like either a permissions problem or that intervening 
directories don't exist. I'm going to guess the latter, since I don't 
imagine you've supplied the directory structure leading to 
work_tomcat_client_app.

 > Oct 02, 2013 11:14:09 AM org.apache.catalina.loader.WebappClassLoader
 > validateJarFile
 > INFO:
 > validateJarFile(/work/tomcat/<client_app>/current/webapps
 > /<client_app>web/WEB-INF/lib/servlet-api.jar)
 > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending
 > class:
 > javax/servlet/Servlet.class

This is a problem with your build. Do NOT include servlet-api.jar in 
your directory or WAR file.

I don't know how you build your projects (I normally use Maven so I can 
move between Eclipse and NetBeans). However, both IDEs will include the 
appropriate servlet JARs on the build path without you having to add 
them yourself (as long as you associate the project with a server).

If you're using straight Ant to build your projects, you can use an 
excludesfile directive to point to a list of JARs to exclude from the WAR.

 > Oct 02, 2013 11:14:10 AM org.apache.catalina.util.SessionIdGenerator
 > createSecureRandom
 > INFO: Creation of SecureRandom instance for session ID generation
 > using
 > [SHA1PRNG] took [219] milliseconds.
 > Initializing Data Sourcedata/conf/db.properties
 > Initializing DB connection pool
 > DB Configuration file path :
 > /work/tomcat/<client_app>/current/webapps/<client_app>web/data/conf
 > /db.properties

I really do not understand the directory architecture you have here. To 
me it looks like a trainwreck.

In general, it's not a good idea to place your database properties file 
in a place that's web accessible. This of course means that someone 
could browse to db.properties, and read all sorts of potentially 
sensitive information.

It's better to place this information in WEB-INF/classes, and use 
getResourceAsStream to read your information.

It's even better to set up a JNDI connection pool and let Tomcat manage 
this for you. Unfortunately with the mess that this Tomcat is in, it's 
probably better to manage the database connections in your application.

 > dbClass : net.sourceforge.jtds.jdbc.Driver
 > Enter
 > Enter
 > Data Source created successfully
 > Initializing Application Parameters
 > Oct 02, 2013 11:14:11 AM org.apache.jasper.EmbeddedServletOptions <init>
 > SEVERE: The scratchDir you specified:
 > /work/tomcat/<client_app>/v1.0/work/<client_app>/localhost
 > /work_tomcat_<client_app>
 > is unusable.
 > Oct 02, 2013 11:14:11 AM org.apache.catalina.startup.HostConfig start
 > SEVERE: Unable to create directory for deployment:
 > /work/tomcat/<client_app>/v1.0/conf/<client_app>/localhost

And now we get to the heart of the matter. The directory cannot be 
created, so JSP pages can't be compiled, etc. etc. etc. This is most 
likely due to a complete misunderstanding about how to configure Tomcat 
in general and contexts in particular by your client.

 > Oct 02, 2013 11:14:11 AM org.apache.catalina.startup.HostConfig
 > deployDirectory
 > INFO: Deploying web application directory
 > /work/tomcat/<client_app>/v1.0/webapps/<client_app>web
 > Oct 02, 2013 11:14:11 AM org.apache.catalina.loader.WebappClassLoader
 > validateJarFile
 > INFO:
 > validateJarFile(/work/tomcat/<client_app>/current/webapps
 > /<client_app>web/WEB-INF/lib/servlet-api.jar)
 > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:


 > javax/servlet/Servlet.class
 > Initializing Data Sourcedata/conf/db.properties
 > Initializing DB connection pool
 > DB Configuration file path :
 > /work/tomcat/<client_app>/current/webapps/<client_app>web/data/conf
 > /db.properties
 > dbClass : net.sourceforge.jtds.jdbc.Driver
 > Enter
 > Enter
 > Data Source created successfully
 > Initializing Application Parameters
 > Oct 02, 2013 11:14:12 AM org.apache.jasper.EmbeddedServletOptions
 > <init>
 > SEVERE: The scratchDir you specified:
 > /work/tomcat/<client_app>/v1.0/work/<client_app>/localhost
 > /<client_app>web
 > is unusable.
 > Oct 02, 2013 11:14:12 AM org.apache.coyote.AbstractProtocol start
 > INFO: Starting ProtocolHandler ["http-bio-25170"]
 > Oct 02, 2013 11:14:12 AM org.apache.catalina.startup.Catalina start
 > INFO: Server startup in 3073 ms
 >
 >
 >
 > 4) OS version
 > *SunOS wpsun1000 5.10 Generic_147147-26 sun4v sparc sun4v*
 >
 >

In short, the installation of Tomcat that your client has set up is more 
or less completely a trainwreck. Without seeing server.xml, it will be 
very difficult to decipher what they were trying to accomplish, and what 
in the world they did.

What I would recommend that they do is the following:

1. Create an unprivileged account - call it tomcat
2. Download a fresh copy of Tomcat 7.0.42 (the .tar.gz file)
3. Unpack this file in the home directory of the user tomcat
    a. this will create apache-tomcat-7.0.42
    b. DO NOT CHANGE ANYTHING
4. Start up Tomcat - browse to port 8080 - verify that it runs
5. Copy your WAR file to apache-tomcat-7.0.42/webapps
    a. verify that it is exploded (should be)
    b. verify that you can browse to port host:8080/client_app

Once this is done, then your client can go about changing the 
configuration to better suit their (perceived) operational needs.

If they have questions about this, tell them to join the Tomcat mailing 
list and ask.

Outside of you including servlet-api.jar in your web application (see 
above notes), this is entirely about their (mis)configuration of Tomcat.

. . . . just my two cents
/mde/

 > The traditional way of deploying applications on Tomcat is through a
 > WAR
 > file. Please read the following on how to deploy applications to
 > Tomcat.
 >
 > http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html
 >
 >
 > I'm a little suspicious of several things:
 >
 > 1. Creating a special directory on Solaris
 >
 > Normally (unless you use contexts - see reference above), the web
 > application should be placed in the appBase directory as defined in
 > server.xml. This is typically $CATALINA_BASE/webapps.
 >
 > 2. Runs on Windows but does not run on Solaris
 >
 > Depending on the errors, this could be one of several things.
 >
 > a) CLASSPATH issues
 > b) JNI libraries
 > c) JDBC drivers - if your application talks to a database
 > d) Permissions problems
 >
 > Let's take these one at a time.
 >
 > It's been my experience (and I'll probably get a talking-to for this)
 > that
 > Eclipse users tend to mangle CLASSPATH settings in order to get web
 > applications to work. All application resources (except container
 > managed
 > resources) belong in one of two places:
 >
 > WEB-INF/lib - for JAR files
 > WEB-INF/classes - for class files and other resources like log4j.xml
 >
 > Eclipse in its normal settings will include these two directories on
 > the
 > build path, and copy compiled classes to WEB-INF/classes. There
 > should be
 > no reason to alter the CLASSPATH.
 >
 > JNI (Java Native Interface) is way to marry native code and Java code
 > (loosely speaking). Obviously native code compiled for Windows will
 > not run
 > on a Solaris system.
 >
 > JDBC drivers enable your application to communicate with a database.
 > If the
 > database connection is controlled by Tomcat (and you access it via a
 > JNDI
 > pooled connection - highly recommended), you need to place the JDBC
 > driver
 > inside $CATALINA_BASE/lib. Otherwise, if you manage your own database
 > connections, the JAR containing the JDBC driver belongs with your
 > other
 > resources - in WEB-INF/lib.
 >
 > It's odd that the client's IT department created a special folder for
 > your
 > web application. I wonder if the user running Tomcat has permissions
 > to
 > read the directory they created - and that the permissions of the
 > files you
 > copied are proper as well.
 >
 > If the above does not address your particular situation, then I'm
 > afraid
 > I'm at the end of my crystal ball (mixed metaphors are fun). Please
 > answer
 > the questions posed at the beginning of my reply, and hopefully
 > others will
 > have ideas.
 >
 > . . . just my (procrastinating) 2 cents
 > /mde/
 >
 >
 > On Tue, Oct 1, 2013 at 10:43 PM, Mark Eggers <its_toasted@yahoo.com>
 > wrote:
 >
 >>> ________________________________
 >>> From: Ravi Shankar <ravishankar356@gmail.com>
 >>> To: users <users@tomcat.apache.org>
 >>> Sent: Tuesday, October 1, 2013 9:13 PM
 >>> Subject: Fwd: unable to start web application in tomcat-solaris,
 >>> same
 >> works in tomcat-windows
 >>>
 >>>
 >>> Hi there,
 >>> Im developing web applications in tomcat ver 7 and running the same 
 >>> in my
 >>> local machine which has windows xp OS. They seem to be running fine
 >>> without
 >>> issues.
 >>>
 >>> However client has provided their solaris servers and wanting me to
 >>> deploy
 >>> it in tomcat ver 7 installed on this server since due to high
 >>> expected
 >>> hits(whenever application is deployed to production) we were
 >>> provided with
 >>> solaris-tomcat servers.
 >>>
 >>> I tried to manually ftp (contents of application in webapps
 >>> directory of
 >>> windows) to solaris box and copied it to application folder created
 >>> by
 >>> client IT team. However when i start my application i get errors
 >>> and my
 >>> application does not seem to work as expected. Im sort of
 >>> struggling on
 >>> how
 >>> to get this application working in solaris, which actually works in
 >>> windows
 >>> OS.
 >>>
 >>> Whenever i migrate from windows to solaris tomcat environment, are
 >>> there
 >>> any best practises i need to remember, and make sure they are in
 >>> place so
 >>> that there are no issues ?
 >>>
 >>> Appreciate your suggestions.
 >>>
 >>> Ravi
 >>
 >>
 >>
 >> Ravi,
 >>
 >> I don't have a lot of suggestions, but I do have a lot of questions.
 >>
 >> 1. What is the exact version of Tomcat 7?
 >> 2. What is the exact version of Java that you are running?
 >> 3. What are specific examples of some errors you are encountering?
 >>    Please include actual log entries, and not summations.
 >>
 >> The traditional way of deploying applications on Tomcat is through a
 >> WAR
 >> file. Please read the following on how to deploy applications to
 >> Tomcat.
 >>
 >> http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html
 >>
 >>
 >> I'm a little suspicious of several things:
 >>
 >> 1. Creating a special directory on Solaris
 >>
 >> Normally (unless you use contexts - see reference above), the web
 >> application should be placed in the appBase directory as defined in
 >> server.xml. This is typically $CATALINA_BASE/webapps.
 >>
 >> 2. Runs on Windows but does not run on Solaris
 >>
 >> Depending on the errors, this could be one of several things.
 >>
 >> a) CLASSPATH issues
 >> b) JNI libraries
 >> c) JDBC drivers - if your application talks to a database
 >> d) Permissions problems
 >>
 >> Let's take these one at a time.
 >>
 >> It's been my experience (and I'll probably get a talking-to for
 >> this) that
 >> Eclipse users tend to mangle CLASSPATH settings in order to get web
 >> applications to work. All application resources (except container
 >> managed
 >> resources) belong in one of two places:
 >>
 >> WEB-INF/lib - for JAR files
 >> WEB-INF/classes - for class files and other resources like log4j.xml
 >>
 >> Eclipse in its normal settings will include these two directories on
 >> the
 >> build path, and copy compiled classes to WEB-INF/classes. There
 >> should be
 >> no reason to alter the CLASSPATH.
 >>
 >> JNI (Java Native Interface) is way to marry native code and Java code
 >> (loosely speaking). Obviously native code compiled for Windows will
 >> not run
 >> on a Solaris system.
 >>
 >> JDBC drivers enable your application to communicate with a database. 
 >> If
 >> the database connection is controlled by Tomcat (and you access it
 >> via a
 >> JNDI pooled connection - highly recommended), you need to place the
 >> JDBC
 >> driver inside $CATALINA_BASE/lib. Otherwise, if you manage your own
 >> database connections, the JAR containing the JDBC driver belongs
 >> with your
 >> other resources - in WEB-INF/lib.
 >>
 >> It's odd that the client's IT department created a special folder
 >> for your
 >> web application. I wonder if the user running Tomcat has permissions
 >> to
 >> read the directory they created - and that the permissions of the
 >> files you
 >> copied are proper as well.
 >>
 >> If the above does not address your particular situation, then I'm
 >> afraid
 >> I'm at the end of my crystal ball (mixed metaphors are fun). Please
 >> answer
 >> the questions posed at the beginning of my reply, and hopefully
 >> others will
 >> have ideas.
 >>
 >> . . . just my (procrastinating) 2 cents
 >> /mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message