aspose file tools*
The moose likes Struts and the fly likes struts application deployment in tomcat server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts application deployment in tomcat server" Watch "struts application deployment in tomcat server" New topic
Author

struts application deployment in tomcat server

siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Hi,
can you please tell, how to build and deploy a struts application in tomcat webserver.
Thanks in Advance
Siddharth
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
check THIS link.
you will get some example of struts with Tomcat.


Thanks,
Shailesh
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Please tell me the detail steps and what is the directory structure.
Thanks
Siddharth
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Please tell me the detail steps and what is the directory structure.
Thanks
Siddharth
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
I unable to do .
Please give some other link.
Thanks,
Siddharth
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
>> webapp >> appName >> WEB-INF >> classes >> put your actions & actionforms classes here (according to package structure).
JSPs any where as in general web application.
>> webapp >> appName >> WEB-INF >> lib >> put struts jar & all related struts custom tag library files.
>> webapp >> appName >> WEB-INF >> put struts-config.xml,web.xml,struts custom tag library .tld files.

restart tomcat & type URL to JSP resource in your application.

siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Is there anything to set in the classpath?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The files in /WEB-INF/lib are put in the webapp's classpath.

You may want to read up on basic Java webapp deployment--these questions aren't really Struts-specific. There's nothing special about a Struts webapp; you just need to deploy the appropriate libraries and have a reasonable configuration.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Please post the code you tried & error you getting.

siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
when i compiled MyAction.java,got compilation error as "cannot resolve symbol ActionMapping"
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you compiling with an appropriate classpath?
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
how to compile with appropriate classpath?which jar file to be added?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

Well, you'll need the Struts jars in the classpath, and whatever the version of Struts you're using depends on.

How to do the compilation depends on how your compiling (using an IDE, Ant, Maven, command-line, etc.) and isn't really Struts-specific. The dependencies depend on which version of Struts you're using--some Struts downloads contain all the dependencies, some don't, but searching the web, reading the documentation, etc. are usually sufficient to get the dependency matrix.
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
I am not using ANT or any IDE.
I simply develop the code in notepad and put those files in the respective folder.
Then I go to command prompt and try to compile the java classes.
I am using struts 1.3.8.
Can it be possible or i have to use ANT.
Please tell me.
Thanks,
Siddharth Das
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, you don't *have* to use Ant. Or a real editor.

But you *do* need to have the Struts libraries on the classpath to compile. For beginner Java questions, like setting the classpath etc. you're probably better off in the Java-General-beginner forum. Just ask how to compile an application with a number of jars on the classpath.
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Which jar file ,I have to set in the classpath.
There are more than one jar files.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
set in the classpath struts.jar file.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

All the ones your application requires--not knowing anything about your application I have no way of knowing what you're using. At the very least you need all the Struts dependencies.

Dependency information is available through documentation, btw, and it would almost certainly be faster to look it up than to wait for someone to answer here. Look here and save yourself some time. That's why the documentation exists.
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
When I run my struts application.I got the following error.

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/xyz" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:202)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1616)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController..java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


Thanks,
Siddharth
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

TellTheDetails
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
I am developing a simple struts application and deploy it in tomcat server.
The components are
register.jsp
success.jsp
failure.jsp
RegisterAction.java
RegisterForm.java
struts-config.xml
web.xml
The contents in register.jsp

The contents in struts-config.xml

But when I run in tomcat server I got the following exception

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/xyz" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:202)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1616)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController..java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
I am not getting the why this exception occured.
Please suggest me.
Thanks,
Siddharth
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Because you're using a random URI for the html taglib--you should use a real one. The uri attribute is *not* insignificant.
siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 124
Now i got the mistake.
thank you...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts application deployment in tomcat server