Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tomcat Vs Weblogic .. jsp/html file path issue..

843840Nov 12 2002 — edited Nov 12 2002
Tomcat gurus, please help !!!
Development Env. :
OS: Window NT 4.0 SP6
Web Server: Tomcat 4.1.12
Sun JDK 1.3.1
IDE : Eclipse 2.1

Deployment/Testing/Prod Env:
OS: Sun Solaris 2.8
Web Server: Weblogic 5.1 SP 12
Sun JDK 1.3.1 IDE : N/A

Confession: New to Tomcat world.

Note: Reason why I'm using Tomcat for development though I can use Weblogic, Eclipse IDE with Tomcat plugin provides debuging functionality, thus the problem. I have an enterprise application being built and kind of stepped into a problem. I have a Servlet that marshals all the calls and process them through java beans ( about 50+ ) and content displayed through JSPs.

Here is the directory structure,
/AppContext
| +- src
| +- com.xyz.wfservices
+- jsp
main.jsp
+- WEB-INF
|
+ classes
+ com.xyz.wfservices ( compiled classes )


For Weblogic: It has 2 parameters to specify where the compiled code is and where the docs are,


=> weblogic.httpd.servlet.classpath=c:/wfservices/WEB-INF/classes

=> weblogic.httpd.documentRoot= c:/wfservices/src/html

and to register instance,

weblogic.httpd.register.WfServices=com.xyz.wfservices.WfSvcsController
weblogic.httpd.initArgs.WfServices=\
main.properties=c:/wfservices/src/properties/wfservices.properties

But, I looked at Tomcat it is quite different.. it has <Context path="/wfs" docBase="L:\app_services\wfservices" workDir="L:\app_services\wfservices\work" /> Servlet def in web.xml

<servlet>
<servlet-name>WfServices</servlet-name>
<servlet-class>com.xyz.wfservices.WfSvcsController</servlet-class>
<init-param>
<param-name>main.properties</param-name>
<param-value>c:\wfservices\properties\config.properties</param-value>
</init-param>
<servlet-mapping>
<servlet-name>WfServices</servlet-name>
<url-pattern>/WfServices</url-pattern>
</servlet-mapping>
</servlet>


Probem: Accessing JSP/Html ... documents. weblogic accessing / calling jsp ..


rd = req.getRequestDispatcher("/main.jsp"); //req is HttpRequest
if (rd != null)
rd.forward(req, resp);

The same does not work under Tomcat because it can find files relative to the context, thus it fails. I have to change the code like below to make it work.

rd = req.getRequestDispatcher("/src/jsp/main.jsp");
if (rd != null)
rd.forward(req, resp);

It is a nightmare now to maintain two different environments and more over changing all the references and and its internal references is not feasible. The question is, is there a way to configure docBase in tomcat so that I won't need a code change.

Any help or inputs are greatly appreciated.

Thanks
Meher
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2002
Added on Nov 12 2002
4 comments
463 views