Le fichier .war de mon projet Web a la racine de contexte myapp/something
et il est défini dans le fichier EAR application.xml
.L'appel de Faces L'URL racine du servlet renvoie Nullpointer
Dans ce projet, j'ai quelques servlets qui fonctionnent bien avec cela. Mais maintenant j'ai ajouté un servlet Server Faces au web.xml
avec le motif . Le problème maintenant est que si j'appelle l'URL http://somehost/myapp/something/Monitoring/mySite
je finis dans une boucle NullPointer parce qu'il n'y a aucune vue disponible (problème connu de Websphere, fix for that here). Je pensais en réglant web/page.xhtml
que le welcome-file
dans le web.xml
cela devrait être corrigé, mais il ne s'applique qu'à la racine de contexte de l'application, à savoir /myapp/something
.
Alors ce qui fonctionne est si je fais les appels suivants: http://somehost/myapp/something/Monitoring/mySite/web/page.xhtml
http://somehost/myapp/something
TL; DR
Mais je voudrais voir le page.xhtml
quand je l'appelle http://somehost/myapp/something/Monitoring/mySite
.
Comment puis-je accomplir ceci?
/TL; DR
Voici le web.xml
du projet:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="myProject" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>This is mySite</display-name>
<!-- Change to "Production" when you are ready to deploy -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<servlet>
<description></description>
<display-name>Monitoring</display-name>
<servlet-name>Monitoring</servlet-name>
<servlet-class>some.path.to.Monitoring</servlet-class>
</servlet>
<servlet>
<description></description>
<display-name>MonitoringExtended</display-name>
<servlet-name>MonitoringExtended</servlet-name>
<servlet-class>some.path.to.MonitoringExtended</servlet-class>
</servlet>
<servlet>
<description>
</description>
<display-name>FacesServlet</display-name>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Monitoring</servlet-name>
<url-pattern>/Monitoring</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MonitoringExtended</servlet-name>
<url-pattern>/Monitoring/extended</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/Monitoring/mysite/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>web/page.xhtml</welcome-file>
<welcome-file>faces/web/page.xhtml</welcome-file>
</welcome-file-list>
Voici la partie de mon application.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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
<display-name>myApplication</display-name>
<module>
<ejb>myApplication.jar</ejb>
</module>
<module>
<web>
<web-uri>myProject.war</web-uri>
<context-root>myapp/something</context-root>
</web>
</module>
</application>
Ici, le ibm-web-ext.xml
(héritage, ne pas le toucher):
<?xml version="1.0" encoding="UTF-8"?>
<webappext:WebAppExtension xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:webappext="webappext.xmi"
xmi:id="WebAppExtension_1229358884593" reloadInterval="3"
reloadingEnabled="true" additionalClassPath="" fileServingEnabled="true"
directoryBrowsingEnabled="false" serveServletsByClassnameEnabled="true">
<webApp href="WEB-INF/web.xml#WebApp_ID" />
</webappext:WebAppExtension>
Et enfin le ibm-web-bnd.xml
(héritage aussi, n'a pas touché):
<?xml version="1.0" encoding="UTF-8"?>
<webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_123456789" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#WebApp_ID"/>
</webappbnd:WebAppBinding>