Quantcast

Issue Deploying a WebApp to Tomcat

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue Deploying a WebApp to Tomcat

pjmxx
I am learning about Java servlets and JSP and have just downloaded, installed and configured netbeans 6.9.1 and apache tomcat. When I create a simple webapp and run using tomcat I get the following issue:

C:\murach\servlet_jsp\netbeans\ex_starts\testApp\nbproject\build-impl.xml:683: The module has not been deployed.
BUILD FAILED (total time: 39 seconds)

 which points to:

   <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

of the build-impl.xml

I can manually deploy webapps to tomcat but not through the netbeans ide. Any ideas would be appreciated!




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue Deploying a WebApp to Tomcat

mdeggers
There are a couple of things to check. Please note that I don't run on
Windows Vista or Windows 7, so this may not be entirely correct for your
situation.

Under certain conditions (which I've not been able to reproduce) NetBeans
fails to create a file used for in-place deployment. This will cause
running from within NetBeans to fail.

The file is called context.xml, and is a Tomcat-specific file. It is (should be)
located in Web Pages->META-INF of your project. If it's not there, you'll
have to create it.

Here are some steps to do that.

Create the folder:
1. Right-mouse click in the Web Pages node in the Project tab
2. Select New->Other
3. In the dialog box, select Other
4. Scroll down and find Folder
5. Name the folder META-INF (case is important, even on Windows)

Create the file:
1. Now right-click on the new folder
2. Select New->Other
3. In the dialog box, select XML
4. Choose XML Document
5. Name it context (NetBeans adds .xml)
6. Choose Well-formed Document

File contents:
1. Delete the following from the automatically created file:


Code:
<root>

</root>


2. Add the following to context.xml


Code:
<Context antiJARLocking="true" path="/APath"/>


Note on the above:

APath should be the same as the Context Path for your project. You can
find that by doing the following.

1. Right-mouse click on the Project node and select Properties
2. In the dialog box, click on the Run node
3. Look at the Context Path to get the proper value (replace APath above)

If this doesn't work, then there are potentially other issues. If you've
installed Tomcat as a service, then lots of things will not work cleanly
with NetBeans on Windows. Two things that you will have issues with are
starting/stopping Tomcat (since the service does not have the .BAT files),
and permissions when running a web application in place.

The second problem is due to the fact that Tomcat as a service runs under
a SYSTEM ID with limited access. Tomcat running under this ID may not
be able to read <Project-Name>/build/web, which is where the build
is placed.

The easiest fix is to download a zip copy of Tomcat from
http://tomcat.apache.org, unzip it somewhere convenient, and
point  your IDE to that installation of Tomcat. Another choice (although
it won't  help with the start/stop issue) is to run the Tomcat service under
your userid as opposed to the system id. There are potential security
issues  with this approach. Finally, you could change the permissions on
NetBeansProjects and below to allow the system id read access. Again, this
has potential security issues.

Summary

1. Make sure that there is a META-INF/context.xml file
2. Create it if needed
3. Run Tomcat under your userid

Hope this helps.

. . . . just my two cents.

/mde/




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue Deploying a WebApp to Tomcat

pjmxx
In reply to this post by pjmxx
thank you for your response. All of your information seemed to be not an issue with my problem.

Interestingly, I decided to try tomcat 6.0 instead of 7.0 that I was working with and it worked. I do not know why it worked exactly but I found that the necessary files were being created in the tomcat conf\Catalina\localhost directory when the webapp was run in Netbeans which did not occur with version 7.0. I wish i knew why that was the case.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue Deploying a WebApp to Tomcat

mdeggers
In reply to this post by pjmxx

pjmxx wrote:
> thank you for your response. All of your information seemed to be not an issue with my problem.
>
> Interestingly, I decided to try tomcat 6.0 instead of 7.0 that I was working with and it worked. I do not know why it worked exactly but I found that the necessary files were being created in the tomcat conf\Catalina\localhost directory when the webapp was run in Netbeans which did not occur with version 7.0. I wish i knew why that was the case.

Yes, that's where the file ends up. Rules on how it's copied and deleted
can be found by reading the Tomcat documentation.

You didn't say you were trying to run Tomcat 7.0.x. Tomcat 7 is not
supported on NetBeans 6.9.1.

If you wish to use Tomcat 7, you'll have to install NetBeans 7. I've run
Tomcat 7.0.12 (current release) successfully with NetBeans 7.0RC2
(current release).

. . . . just my two cents

/mde/




Loading...