aspose file tools*
The moose likes Struts and the fly likes struts/jboss/tomcat application not working 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 » Frameworks » Struts
Bookmark "struts/jboss/tomcat application not working" Watch "struts/jboss/tomcat application not working" New topic
Author

struts/jboss/tomcat application not working

ketandba shah
Greenhorn

Joined: Feb 05, 2005
Posts: 22
I am newbie in struts/jboss/tomcat..

I have develop the first web application....
1) My application development dir structure :

root : c:_\development\jakarata-struts-1.2.4\jakarata-struts-1.2.4\workspace\otsStruts
build.xml
+ src
+java
+ net
+ abc
+ otsStruts
+ webInvoiceInfo
all *.java files
+ web
all *.jsp
+ WEB-INF ---------->>> (under /web)
all *.tld, struts-config.xml, tiles-def.xml
+class
all *.class
+build
++ deploymentdescriptor
application.xml, web.xml
++ src
all *.class
++ jar
all *.jar
++ear
invoice.war
+++ META-INF
application.xml
++war
all *.jsp *.css
+++ WEB-INF
web.xml
++++ classes
all *.class
++++ lib
all *.jar

+ WEB-INF ---------> (default output project path)
++ classes
***************end application directory structure *************
2) build.xml (ant 1.6 builder)

<?xml version="1.0"?>

<project name="otsStruts" default="all" basedir=".">
<!-- Main target -->
<target name="all" depends="init,clean,createDir,build,buildWar,buildEar"/>

<target name="init">
<property name="dirs.base" value="${basedir}"/>

<property name="dirs.build" value="${dirs.base}/build"/>
<property name="src" value="${dirs.base}/src"/>
<property name="web" value="${dirs.base}/web"/>

<property name="deploymentdescription" value="${dirs.build}/deploymentdescriptors"/>
<property name="classdir" value="${dirs.build}/src"/>
<property name="jardir" value="${dirs.build}/jar"/>
<property name="earDir" value="${dirs.build}/ear"/>
<property name="warDir" value="${dirs.build}/war"/>

<property name="warFile" value="lawyerInvoice.war"/>
<property name="earFile" value="lawyerInvoice.ear"/>

<property name="host" value="aziza" />
<property name="port" value="8080" />
<property name="jbossDeployDir" value="\\${host}\ketan-jboss-home\server\instance1\deploy"/>
</target>

<!-- The "clean" target deletes any previous "build" directory,
so that you can be ensured the application can be built from scratch. -->
<target name="clean"
description="Delete old WEB-INF and WEB-INF/classes,WEB-INF/lib and META-INF directories">
<delete dir="${warDir}/WEB-INF/classes"/>
<delete dir="${warDir}/WEB-INF/lib"/>
<delete dir="${warDir}/WEB-INF"/>
<delete dir="${earDir}/META-INF"/>
</target>

<!-- Create Web-inf & classes & lib directories -->
<target name="createDir">
<mkdir dir="${warDir}/WEB-INF"/>
<mkdir dir="${warDir}/WEB-INF/classes"/>
<mkdir dir="${warDir}/WEB-INF/lib"/>
<!-- Create Meta-inf directories -->
<mkdir dir="${earDir}/META-INF"/>
</target>

<!-- Compile Java Files and store in /build/src directory -->
<target name="build" >
<javac srcdir="${src}" destdir="${classdir}" debug="true" includes="**/*.java" />
</target>

<!-- Create the War File -->
<target name="buildWar" >
<copy todir="${warDir}">
<fileset dir="${web}" includes="**/*.jsp" />
<fileset dir="${web}" includes="**/*.css" />
</copy>
<copy todir="${warDir}/WEB-INF">
<fileset dir="${deploymentdescription}" includes="web.xml" />
</copy>
<copy todir="${warDir}/WEB-INF/classes/">
<fileset dir="${classdir}" includes="**/*.class" />
</copy>
<copy todir="${warDir}/WEB-INF/lib">
<fileset dir="${jardir}" includes="**/*.jar" />
</copy>
<!-- Create war file and place in ear directory -->
<jar jarfile="${earDir}/${warFile}" basedir="${warDir}" />
</target>
<!-- Create the Ear File -->
<target name="buildEar">
<copy todir="${earDir}/META-INF">
<fileset dir="${deploymentdescription}" includes="application.xml" />
</copy>
<!-- Create ear file and place in ear directory -->
<jar jarfile="${dirs.base}/${earFile}" basedir="${earDir}" />
</target>


</project>
************ end of build.xml ***********

3) deployment dirctory structure on jboss server (jboss-3.2.5 along with tomcat 5.0)

z: \server\instance1\deploy

invoice.ear -------->>>> (copied after succesfull buid)

+ otsStruts
++ WEB-INF
+++ classes
+++ lib
+ jbossweb-tomcat50.sar
4) here web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!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>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/web/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/do/*</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
5) here application.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<application>
<display-name> Invoice</display-name>
<module>
<web>
<web-uri>Invoice.war</web-uri>
<context-root>/otsStruts</context-root>
</web>
</module>
</application>

6) after succesful build .ear file is generated.

Copy this .ear file in deploy dir structure(i.e z:\server\instance1\deploy)
restart jboss-3.2.5 server.....

for testing :

http://ipAddress:8080/otsStruts/index.jsp -----

errorr message : page cannot display....wrong uri....

pl. help me out.....
I am suspecting some error in.....
1) may be some setting on tomcat...
2) wrong directory structure.....
3) wrong deployment ...setting some parameters on jboss-3.2.5

I have spent complete 4 days (almost 50 hrs....)...but can't get result......

Your help is appriciated......
Thanks in advance....

ketan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts/jboss/tomcat application not working