aspose file tools*
The moose likes Tomcat and the fly likes Help deploying app-duke bookstore .WAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Help deploying app-duke bookstore .WAR file" Watch "Help deploying app-duke bookstore .WAR file" New topic
Author

Help deploying app-duke bookstore .WAR file

tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
Hey Guys,

I have been working through the tutorial of building the Duke Bookstore app on the sun website:http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro3.html

I got the bookstore2app to run -displaying all the pages, using the cloudscape db etc. I fired up the j2ee server and deployed the app using the provided deployer tool.

I would like to move this app and deploy it using the Tomcat server. I copied over the .WAR file to the /webapps directory. When I restarted the tomcat server, the directory structure stucture for the app was created ok-
webapps/bookstore2.

When I try to access the app, I get the 404 error. I have tried different URLs and still cant get the start page to display. Any suggestions?

Thanks,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Moved to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What's the name of the directory that was created under webapps?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
The dir is bookstore2

bookstore2- contains the .jsp files
...META-INF
...WEB-INF-contains web.xml
..classes
..cart
..database
..messages
..util
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

and what url are you using to access it?

Should be http://localhost:8080/bookstore2

It's case sensitive.
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
I have used the following and other url's as well:
http://localhost:8080/bookstore2/
and get the 404 error. When the j2ee server is fired up, I used http://localhost:8000/bookstore2/enter and it worked fine.

Also, I am able to run other .jsp files in the webapps/root directory.

The web.xml for this app is:

<web-app>
<display-name>Bookstore2WAR</display-name>
<description>no description</description>
<servlet>
<servlet-name>cashier</servlet-name>
<display-name>cashier</display-name>
<description>no description</description>
<jsp-file>/cashier.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>banner</servlet-name>
<display-name>banner</display-name>
<description>no description</description>
<jsp-file>/banner.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>enter</servlet-name>
<display-name>enter</display-name>
<description>no description</description>
<jsp-file>/bookstore.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>receipt</servlet-name>
<display-name>receipt</display-name>
<description>no description</description>
<jsp-file>/receipt.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>showcart</servlet-name>
<display-name>showcart</display-name>
<description>no description</description>
<jsp-file>/showcart.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>catalog</servlet-name>
<display-name>catalog</display-name>
<description>no description</description>
<jsp-file>/catalog.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>bookdetails</servlet-name>
<display-name>bookdetails</display-name>
<description>no description</description>
<jsp-file>/bookdetails.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>cashier</servlet-name>
<url-pattern>/cashier</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>enter</servlet-name>
<url-pattern>/enter</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>receipt</servlet-name>
<url-pattern>/receipt</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>showcart</servlet-name>
<url-pattern>/showcart</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>catalog</servlet-name>
<url-pattern>/catalog</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>bookdetails</servlet-name>
<url-pattern>/bookdetails</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>

[ April 26, 2005: Message edited by: tim mahoney ]
[ April 26, 2005: Message edited by: tim mahoney ]
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
Also, I don't think Tomcat is seeing /bookstore2. I placed a basic html, which works with other apps and I get the 404 error. The URL is http://localhost:8080/bookstore2/
Is there a master file or something that I need to modify? Thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Create a welcome-file-list entry in your web.xml file so you can have a default page.
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
Just want to make sure this is right:
I have my J2EE_HOME =c:\j2sdkee1.3.1

The bookstore2 app works fine when I fire up the j2ee server under j2sdkee1.3.1/bin/j2ee.bat. When I close down this server and fire up the tomcat server, the app will not run.

Also,I did a search for welcome-file-list in my directory and didnt find any. I will keep banging at this. The index file does come up for other apps. I did put the welcome-list tag in my web.xml and the index page didnt load using url http://localhost:8000/bookstore2/

....
<?xml version="1.0" encoding="Cp1252"?>

<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>


<web-app>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<display-name>Bookstore2WAR</display-name>
<description>no description</description>
<servlet>
<servlet-name>cashier</servlet-name>
<display-name>cashier</display-name>
<description>no description</description>
<jsp-file>/cashier.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>banner</servlet-name>
.....
....
If anyone has any ideas on how to get the application to run in tomcat, Please post. Thanks

[ April 26, 2005: Message edited by: tim mahoney ]
[ April 26, 2005: Message edited by: tim mahoney ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In a 2.3 DTD, welcome-file-list needs to come AFTER the servlet mappings.
In 2.4, they've lifted the restriction on the order of elements in web.xml
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
What version of Tomcat are you using? Have you verified that Tomcat is up and running correctly by accessing the default Tomcat page:


Check the log file either thru the console or the catalina.out file to see if the bookstore2 war file was deployed without any problems.
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
Tomcat version:
jakarta-tomcat-5.5.9

Yes, verified tomcat is running.

Did not have a file named catalina.out.

Keep in mind that I used the delployer tool in j2sdkee1.3.1 to create the app. I moved the .war file over to the tomcat dir.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I can try running the war file on my machine if you like.
Check your private messages for an address to send it to.
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
I copied the bookstore2 folder that was created in j2ee and placed in my webapps/. Started tomcat and got the following errors? Making some progress here. Any ideas on this?

exception

javax.servlet.ServletException: exception/BooksNotFoundException
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NoClassDefFoundError: exception/BooksNotFoundException
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
java.lang.Class.getConstructor0(Class.java:1930)
java.lang.Class.getConstructor(Class.java:1027)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1218)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The type database.BookDBEJB cannot be resolved. It is indirectly referenced from required .class files


Is this an ejb app?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The implementation of the database helper object follows. The bean has two instance variables: the current book and a reference to the database enterprise bean.


Tomcat is not an EJB container.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

JBoss is an open source EJB container that uses Tomcat as it's servlet/jsp engine.
tim mahoney
Ranch Hand

Joined: Apr 19, 2005
Posts: 33
That is the problem. Thanks Ben and everyone else that helped. I will look into JBOSS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help deploying app-duke bookstore .WAR file