[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Linux Ubuntu Tomcat deployment

Posted on 2009-02-09
32
Medium Priority
?
1,929 Views
Last Modified: 2012-05-06
Hi: I am a beginner to use ubuntu. I just installed tomcat5.5 and tomcat5.5-webapps by command:
sudo apt-get install tomcat5.5 tomcat5.5-webapps

Now I generate a war file by Eclispe. I put war file into /usr/share/tomcat5.5-webapps/. and /usr/share/tomcat5.5/webapps. But it always get 404 error when I try to open the link. In windows, when tomcat is started up, the war file would be unzipped. Why in ubuntu, it did not?
0
Comment
Question by:JianJunShen
  • 13
  • 12
  • 7
32 Comments
 
LVL 92

Expert Comment

by:objects
ID: 23588140
it should be in /usr/share/tomcat5.5/webapps


you do npot actually need to install  tomcat5.5-webapps

what is the context name?  
what path are you trying to load it with?

0
 

Author Comment

by:JianJunShen
ID: 23588211
The war file name is addemo.war. In window, I could access it by typing http://localhost:8080/addemo. In ubuntu, I type http://localhost:8180/addemo
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 480 total points
ID: 23588236
Make sure that you have the correct file permissions to deploy. Probably best to add yourself to the tomcat user group and make sure everything's group-writable in the tomcat tree
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23588240
check the logs, the answer is more than likely there.

0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23588245
is the war getting expanded?

0
 

Author Comment

by:JianJunShen
ID: 23589043
the war file is not getting expanded
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 480 total points
ID: 23589061
Are you able to writer to that directory?
0
 
LVL 92

Expert Comment

by:objects
ID: 23589108
check is tomcat actually running

you haven't changed the default server.xml have you?

0
 

Author Comment

by:JianJunShen
ID: 23589140
Yes, I do not have right to write anything in /usr/share/tomcat5.5/webapps directory. I have not yet chanaged anything in server.xml.

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 23589160
>>Yes, I do not have right to write anything

Then you won't be able to deploy anything. You need to make the changes i mentioned
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23589167
you don't need access to write to that directory.

Have you changed any of the tomcat config?
Are you using the init.d script to start?

whats the output from:

ps -ef|grep tomcat

0
 

Author Comment

by:JianJunShen
ID: 23589246
HI: I am using sudo /etc/init.d/tomcat5.5 start.

What does ps -ef means?

After I type ps -ef|grep tomcat, the output in the termianl is as follows:

juhanishen@juhanishen-desktop:/usr/share/tomcat5.5/webapps$ ps -ef|grep tomcat
root     11136     1  0 09:59 ?        00:00:00 /usr/bin/jsvc -user tomcat55 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat5.5/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat5.5.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat5.5/common/endorsed -Dcatalina.base=/var/lib/tomcat5.5 -Dcatalina.home=/usr/share/tomcat5.5 -Djava.io.tmpdir=/var/lib/tomcat5.5/temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat5.5/conf/logging.properties org.apache.catalina.startup.Bootstrap
root     11137 11136  0 09:59 ?        00:00:00 /usr/bin/jsvc -user tomcat55 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat5.5/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat5.5.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat5.5/common/endorsed -Dcatalina.base=/var/lib/tomcat5.5 -Dcatalina.home=/usr/share/tomcat5.5 -Djava.io.tmpdir=/var/lib/tomcat5.5/temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat5.5/conf/logging.properties org.apache.catalina.startup.Bootstrap
tomcat55 11139 11136  0 09:59 ?        00:00:10 /usr/bin/jsvc -user tomcat55 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat5.5/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat5.5.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat5.5/common/endorsed -Dcatalina.base=/var/lib/tomcat5.5 -Dcatalina.home=/usr/share/tomcat5.5 -Djava.io.tmpdir=/var/lib/tomcat5.5/temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat5.5/conf/logging.properties org.apache.catalina.startup.Bootstrap
1000     11796 10656  0 13:57 pts/0    00:00:00 grep tomcat
0
 
LVL 92

Expert Comment

by:objects
ID: 23589259
that all looks fine.
have u checked the logs?

0
 
LVL 92

Expert Comment

by:objects
ID: 23589262
> What does ps -ef means?

lists the running processes

man ps

0
 

Author Comment

by:JianJunShen
ID: 23589312
catalina.log file shows:

java.util.zip.ZipException: error in opening zip file
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.<init>(ZipFile.java:131)
      at java.util.jar.JarFile.<init>(JarFile.java:150)
      at java.util.jar.JarFile.<init>(JarFile.java:87)
      at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:90)
      at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:66)
      at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:86)
      at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.ja
va:122)
      at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection
.java:89)
      at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:141)
      at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.ja
va:872)
      at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:990
)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:279)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
      at org.apache.catalina.core.StandardContext.init(StandardContext.java:50
71)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
984)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720
)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:293)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBas
e.java:1306)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1570)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1579)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.r
un(ContainerBase.java:1559)
      at java.lang.Thread.run(Thread.java:636)
Feb 9, 2009 10:06:18 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : /var/lib/to
mcat5.5/webapps/addemo.war
      at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.ja
va:130)
      at org.apache.catalina.core.StandardContext.resourcesStart(StandardConte
xt.java:3855)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
024)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720
)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:293)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBas
e.java:1306)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1570)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1579)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.r
un(ContainerBase.java:1559)
      at java.lang.Thread.run(Thread.java:636)
Feb 9, 2009 10:06:18 AM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
0
 
LVL 92

Expert Comment

by:objects
ID: 23589320
war appears to be unreadable/corrupt

0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23589326
whats the outpiut of the following:

ls -l /var/lib/tomcat5.5/webapps/addemo.war
jar tvf /var/lib/tomcat5.5/webapps/addemo.war
0
 

Author Comment

by:JianJunShen
ID: 23589335
It seems that my ant script is done adpat to windows envinronment. Does that matter? Does Linux could recognize windows zip.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 480 total points
ID: 23589367
Shouldn't generally matter - Ant is cross-platform, although it could be made to break. What is this script that you're using - please attach it
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23589433
make sure the war is readable

sudo chown tomcat55 /var/lib/tomcat5.5/webapps/addemo.war

0
 

Author Comment

by:JianJunShen
ID: 23589519
After I use chmode 777 addemo.war, and restart the tomcat, it expands addemo.war file. But now problem comes for the following error when I check the catalina.log file:

Feb 9, 2009 2:44:32 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Feb 9, 2009 2:44:32 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/addemo] startup failed due to previous errors

So I still could not access http://localhost:8180/addemo. Any idea?
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 480 total points
ID: 23589532
Clear the log file, restart and attach it please (or post if short)
0
 

Author Comment

by:JianJunShen
ID: 23589592
Feb 9, 2009 2:56:28 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/i386:/lib:/usr/lib
Feb 9, 2009 2:56:28 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8180
Feb 9, 2009 2:56:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 884 ms
Feb 9, 2009 2:56:28 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 9, 2009 2:56:28 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5
Feb 9, 2009 2:56:28 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Feb 9, 2009 2:56:30 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive addemo.war
Feb 9, 2009 2:56:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Feb 9, 2009 2:56:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/jsp-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
Feb 9, 2009 2:56:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Feb 9, 2009 2:56:32 PM org.apache.catalina.core.StandardContext startSEVERE: Error listenerStartFeb 9, 2009 2:56:32 PM org.apache.catalina.core.StandardContext startSEVERE: Context [/addemo] startup failed due to previous errors
Feb 9, 2009 2:56:33 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8180
Feb 9, 2009 2:56:33 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 9, 2009 2:56:33 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/44  config=null
Feb 9, 2009 2:56:33 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Feb 9, 2009 2:56:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4856 ms
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 23589624
You need to move those jars 'not loaded' out of your web app
0
 

Author Comment

by:JianJunShen
ID: 23589630
But in windows, it does not matter. I will try it in linux.
0
 

Author Comment

by:JianJunShen
ID: 23594757
I deployed a simple servlets without database connection. Tomcat deployed this simple servlets and it worked well. I am afraid it is because addemo has database backend. And in web.xml there is JNDI for database which does not have correponding .xml file. I will install MySQL tomorrow to see what happend after that.
0
 
LVL 92

Expert Comment

by:objects
ID: 23594778
> After I use chmode 777 addemo.war, and restart the tomcat, it expands addemo.war file. But now problem comes for the following error when I check the catalina.log file:

you don't need to do that

> remove the following jars

/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/javaee.jar
/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/jsp-api.jar
/var/lib/tomcat5.5/webapps/addemo/WEB-INF/lib/servlet-api.jar

Thoses classes are already provided by tomcat installation

0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23594875
those jars should only be in your compile path, and should not be part of deployment.
u also probably only need the last one really

0
 

Author Comment

by:JianJunShen
ID: 23594897
But simpleServelt war has same jar files. It deployed successfully and runned succesfully in ubuntu.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1520 total points
ID: 23594935
Its only a warning, its not stopping you're context deploying.

I'm guessing its failing to deploy because it cannot get a db connection
0
 

Accepted Solution

by:
JianJunShen earned 0 total points
ID: 23609526
Finnally, it is factory line in context.xml. Thanks to narrow down my problem
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 23648043
:-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question