i developed an application for university, but for some reasons seems to be impossible for me to set the context-root of it. This is what i tried to do:
Changing context-root from glassfish-web.xml but it's not working. The server recognize ever /web/ path (the name of web module). This is my XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<web-uri>web</web-uri>
<context-root>/</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
I tried to set context-root from asadmin using deploydir. It deploy the app but it run it always to /web/ path.
I tried to check domains.xml, but i have not others apps and my app hasn't a context-root set as a property.
The only strange thing that i see in server logs are this:
SEVERE: Application previously deployed is not at its original location any more: file:/C:/Users/Danilo/Documents/NetBeansProjects/ibei/dist/gfdeploy/ibei/
WARNING: Unsupported deployment descriptors element web-uri value web.
WARNING: Context path from ServletContext: /web differs from path from bundle: web
The last warning is really strange, cause the web app is called simply "web". I tried to make web-uri web, web.war, web_ear but it never recognize the web-uri as correct :(
Finally i found the solution, thx to JBoss doc that are better then glassfish and netbeans togheter. The problem is caused by the presence of an APP composed by two modules: - EJB - WEB
That two modules are contained in an ear that, cause of netbeans, has no "application.xml" so glassfish simply doesn't look at "glassfish-web.xml" and using asadmin can't work too. The only solution is to add the application.xml like this (in the "configuration files" folder of the project):
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
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/application_1_4.xsd">
<display-name>Ibei</display-name>
<module>
<ejb>ejb.jar</ejb>
</module>
<module>
<web>
<web-uri>web.war</web-uri>
<context-root></context-root>
</web>
</module>
</application>