searching webapps deployment target


I have Idea 6.0 and the latest J2EE JDK (with EJB 3.0 and GlassFish).

When using a local web container (in this case GlassFish), to where does Idea deploy the application? I am testing it with a simple test-servlet with url-pattern /test But how do I access it after I started the container from within Idea? For example http://localhost:3370/test and http://localhost:3370/webapps/test and same with a couple of other ports gives me a 404 (or the ports don't use http at all). What is the correct URL? The ones I tried are just guesses based on other IDE/web container combinations.

Of course it is no problem to deploy the web application manually, for example using the web interface at http://localhost:4848/. Then I give it the path to /exploded and it works instantly.

In GlassFish and Idea I only did almost nothing - everything at default.



The default context root is the name of your war file without the .war extension. So if you build your web application into sample.war, then the URL should be http://localhost:8080/sample/test (or port 3370 in your case?).


hello Martin,

thanks for your continued help.

(Your name, Fuhrer, is also in the stack trace of another problem I have - maybe that is not a coincidence. I have to solve this one in order to get to that one again.)

I do not build a war file at all, and so I cannot apply your suggestion directly. I let Idea decide how to deploy it, without influencing this process. I did try to deploy the application manually, and that was not a problem at all, very simple, with or without a .war.



Try this:

- select Run -> Edit Configurations...;
- select your Glassfish run configuration;
- change to Deployment tab;
- select your web module;

The name displayed in the Deployment Source combo box is your context root (after stripping off the .war extension if any).


What I also tried it to use the name of the .war in the URL that would be if I would build a war. (It is the name of the web module by default.) So http://localhost:tried-all-ports-here/modulename/test would be the complete URL. Same result - 404, or an empty body, or an octet stream with a few bytes in the body. In the case of an empty body or an octet stream it is the same results for any arbitrary URL, like http://localhost:whateverport/ThisUriDoesNotExist


Are you sure that your module has been deployed successfully?


Yes, that is the exploded directory which I configured for the project. It contains the deployment-ready data and it is also the data I use when I try (always successfully) a manual deployment. It does not help me to find out the HTTP URL, though. The folder is /exploded relative to my web module: project-root/web-module-name/exploded

Another observation: In the Run console in Idea the Module has a "?" icon, and the tooltip is "Status is unknown. Press 'Refresh' to reload deployment status from server." In the stdout output shown in the Idea Run console there is no message about a successful or failed attempt to deploy my application either. So chances are that it simply has not been deployed, for whatever reasons.

The log of the domain (domain1, as installed by default) does not mention anything about the module name or the configured URI either.

In order to have a comparison to how I think things should be I also added a Tomcat run configuration. Everything worked there instantly. Very interesting was that for the tomcat configuration the Run configuration deployment tab has a setting for the Application context! So I can enter anything there and then access my URI with anything/test. This is not there for GlassFish, so that I have to resort to guessing there. Another difference is that in the Run console the module is shown as successfully deployed instead of unknown.


I am sorry about not checking for successful deployment earlier. The problem now is that I do not know why it has not been deployed. Also sorry about the confusing thread hierarchy I chose.


No problem, we'll sort things out anyway... :)

The deployment of an exploded directory by means of jsr88 (the 'correct' way to deploy a module automatically) is not supported by Glassfish. So you are forced to use a war file (and later versions of the plugin will ensure this). That's the reason why your module is not deployed properly. And of course as long as your module isn't deployed, you won't get any response from it.

So go to your module settings, choose to create a war file, and select this war file as the deployment source in the run configuration. And the name of the war file (without the .war extension) will be your context root.

As for setting the context root manually:
This can be done in the sun-web.xml deployment descriptor by setting the context-root tag.


Looks good now: Idea says "Module j2eewebonly: Module is being deployed, please wait..." forever (waited more than 5 minutes, CPU is almost idle), but in the web interface of GlassFish I was able to first enable, then launch the web application, as it showed up there like half-ready. Then I was able to access it. That only works if Idea has tried it for a couple of minutes already. (Suggestions to overcome these minor oddities are still welcome, though.)

Would you recommend to use another application server? The objective is to try some things with EJB 3.0 for learning purposes only. I am very well familiar with EJB 2.0 and with Servlets & JSP 2.0, but not at all familiar with any web or EJB container implementation.

Thanks a lot for all the help!


The deployment process hanging forever is another oddity of the Glassfish implementation. We've done some improvements in this field for IDEA 6.0.2, but until then the only thing you can do is to try to redeploy the module.


Please sign in to leave a comment.