星期二, 一月 11, 2005

JBOSS如何在Web加如虚拟目录

I made the following changes. Not all of them may be required. You can try one at a time.
1. jboss/server/default/conf/jboss-service.xml
Code:


<server>
<!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
can be restricted to specific jars by specifying them in the archives
attribute.
-->
<classpath codebase="lib" archives="*"/>

<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->




one more place
Code:

<!-- ==================================================================== -->
<!-- Deployment Scanning -->
<!-- ==================================================================== -->
<!-- An mbean for hot deployment/undeployment of archives.
-->
<mbean code="org.jboss.deployment.scanner.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL">

<attribute name="URLs">
deploy/cmpe275, file:///C:/images/
</attribute>





2. jboss/server/default/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
Code:

<server>
<mbean code="org.jboss.web.tomcat.tc5.Tomcat5" name="jboss.web:service=WebServer">
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="LenientEjbLink">true</attribute>
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->

<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->
<attribute name="UseJBossWebLoader">true</attribute>





3. jboss/server/default/deploy/jbossweb-tomcat50.sar/server.xml
Code:

<Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false">
<!-- Default context parameters -->

<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" path="/cmpe275/images"/>





4. copy web.xml to
jboss/server/default/conf

This has worked for me. Hope this helps you.
There has to be easier way to solve this.