<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.abc</groupId>
<artifactId>MyProjectEar</artifactId><version>0.0.1-SNAPSHOT</version>
</parent>
<properties>
<build.plugin.maven.ear.version>2.10.1</build.plugin.maven.ear.version>
</properties>
<artifactId>MyProjectEarModule</artifactId><packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.abc</groupId>
<artifactId>MyProjectJar</artifactId><version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.abc</groupId>
<artifactId>MyProjectWar</artifactId><version>0.0.1-SNAPSHOT</version>
<type>war</type></dependency>
</dependencies>
<build><plugins><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>${build.plugin.maven.ear.version}</version>
<configuration>
<applicationXml>${project.basedir}/src/main/application/META-INF/application.xml</applicationXml>
<finalName>MyProjectEar</finalName>
<defaultLibBundleDir>/lib</defaultLibBundleDir>
<modules>
<webModule>
<groupId>com.abc</groupId>
<artifactId>MyProjectWar</artifactId>
<contextRoot>/testcontextroot</contextRoot>
</webModule>
<jarModule>
<groupId>com.abc</groupId>
<artifactId>MyProjectJar</artifactId>
<bundleDir>/</bundleDir>
</jarModule>
</modules>
</configuration></plugin></plugins></build>
</project>
我正在开发一个项目,其中一个耳朵包含jar并且在将耳朵部署到jboss7之后,当我尝试使用contextroot访问web项目时,我无法访问,也无法在服务器日志中打印任何内容。我相信当我点击http://localhost:8080/testcontextroot时,请求本身不会进入我的服务器。
我已经提供了所需的所有信息以及我正在构建耳朵的pom.xml代码。
\MyProjectEar.ear\
META-INF
jboss-deployment-structure.xml
application.xml
lib
MyProjectWar.war
WEB-INF
lib
classes
web.xml
jboss-web.xml
jboss-deployment-structure.xml
facesconfig.xml
beans.xml
Pages
registration.xhtml
registration_success.xhtml
decorator.xhtml
META-INF
MyProjectJar.jar
\ MyProjectEar.ear \ META-INF JBoss的部署-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.apache.commons.collections" export="true" />
<module name="com.sun.jsf-impl" />
<module name="asm.asm" export="true" />
<module name="org.codehaus.jackson.jackson-mapper-asl" export="true" />
<module name="org.apache.cxf" export="true" />
<module name="org.apache.cxf.impl" export="true" />
</dependencies>
</deployment>
<sub-deployment name="MyProjectJar.jar"></sub-deployment>
</jboss-deployment-structure>
\ MyProjectEar.ear \ META-INF applicaton.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="6"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>testdisplayname</display-name>
<module>
<ejb>MyProjectJar.jar</ejb>
</module>
<module>
<web>
<web-uri>MyProjectWar.war</web-uri>
<context-root>/testconetextroot</context-root>
</web>
</module>
<library-directory>lib</library-directory>
的web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>testdisplay</display-name>
<welcome-file-list>
<!-- <welcome-file>/registration.xhtml</welcome-file> -->
<welcome-file>pages/registration.jsf</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name>Restrict direct access .xhtml.</display-name>
<web-resource-collection>
<web-resource-name>Facelets</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
</web-app>
的JBoss-web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>testcontextroot</context-root>
</jboss-web>
的JBoss部署-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems>
<exclusions>
</exclusions>
<dependencies>
<module name="org.apache.cxf"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
faces-config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<name>app</name>
<navigation-rule>
<from-view-id>/registration.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/registration_success.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
的beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
</beans>