web module context root question

<P><FONT SIZE=2>I am not sure if this question has been posted earlier. I created a Web Module in my working directory and set a context root for the application. I later changed the context root, however, the tomcat server (i.e. server.xml) holds references to all previous context roots. How and where can I delete the references to context roots created in server.xml.</FONT></P>

<P><FONT SIZE=2>Thanks,</FONT>

</P>

<P><FONT SIZE=2>Deepak</FONT>

</P>

[578 byte] By [Prabhu,Deepak] at [2007-11-25 16:48:34]
# 1

Prabhu, Deepak x57335 writes:

# I am not sure if this question has been posted earlier. I created a Web

# Module in my working directory and set a context root for the application. I

# later changed the context root, however, the tomcat server (i.e. server.xml)

# holds references to all previous context roots. How and where can I delete

# the references to context roots created in server.xml.

Hi Deepak,

to undeploy contexts, go to the Runtime tab of the Explorer, open the

Server Registry node and then the Installed Servers node. You should

find a node for the server that you use to execute. If you continue

expanding the tree, you will see a list of deployed web modules. The

popup menu for the individual web contexts allow you to remove them.

If this happens when you change the context root, then it's a bug. I

remember we had this discussion among the engineers a while back and

I'm fairly sure we agreed to fix it. Could you let us know which

version of Netbeans that you are using?

Thanks,

Ana

vonKlopp,Ana at 2007-7-2 23:44:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 2

Sorry to ask an even more basic question, but I see how you add and remove

context from a web application (as you described), and I see how to create a

web module (in the project default tab), but I don't see anyway to tie the

two together. How do you apply a context to a web module? When I execute a

JSP file, NetBeans goes ahead and assumes I want a default web context and

writes one into the server.xml file, then launches a location in the browser

with no context off the web root. I'd prefer it to use an existing context.

Is this possible? Thanks for any help. Sorry if this is a newbie question -

just getting acquainted with NetBeans. I'm using NetBeans 3.4.

Noah

--Original Message--

From: Ana von Klopp [mailto:ana.von.klopp@sun.com]

Sent: Tuesday, August 13, 2002 3:26 PM

To: nbusers@netbeans.org

Subject: Re: web module context root question

Prabhu, Deepak x57335 writes:

# I am not sure if this question has been posted earlier. I created a Web

# Module in my working directory and set a context root for the application.

I

# later changed the context root, however, the tomcat server (i.e.

server.xml)

# holds references to all previous context roots. How and where can I

delete

# the references to context roots created in server.xml.

Hi Deepak,

to undeploy contexts, go to the Runtime tab of the Explorer, open the

Server Registry node and then the Installed Servers node. You should

find a node for the server that you use to execute. If you continue

expanding the tree, you will see a list of deployed web modules. The

popup menu for the individual web contexts allow you to remove them.

If this happens when you change the context root, then it's a bug. I

remember we had this discussion among the engineers a while back and

I'm fairly sure we agreed to fix it. Could you let us know which

version of Netbeans that you are using?

Thanks,

Ana

Davis,Noah at 2007-7-2 23:44:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 3

Noah Davis writes:

# I see how you add and remove context from a web application (as you

# described), and I see how to create a web module (in the project

# default tab), but I don't see anyway to tie the two together. How do

# you apply a context to a web module?

There are two ways to do this.

To change the context root of a web module you are about to execute:

0) Go to the file systems tab in the Explorer

1) Right click the WEB-INF node of the web module.

2) Select "Properties"

3) Change the context root to the value you want it to have.

4) Deploy the web module.

To change the context root of a web module already deployed on a

Tomcat server installation:

0) Go to the runtime tab in the Explorer

1) Expand the Server Registry node

2) Expand the installed Servers node

3) Expand the Tomcat node

4) Select the node corresponding to the server installation you are

working with.

5) Right click the node and select stop server.

6) Expand the node to see the currently deployed web modules

7) Select "Properties" on a web module to change the context root

8) Restart the server

# When I execute a JSP file, NetBeans goes ahead and assumes I want a

# default web context and writes one into the server.xml file, then

# launches a location in the browser with no context off the web

# root. I'd prefer it to use an existing context.

If the context root is set on the web module (as opposed to from the

server registry) then the browser will default to

http://localhost:port/contextroot/

Ana

vonKlopp,Ana at 2007-7-2 23:44:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 4

Ana von Klopp writes:

**

** There are two ways to do this.

**

** To change the context root of a web module you are about to execute:

**

** 0) Go to the file systems tab in the Explorer

** 1) Right click the WEB-INF node of the web module.

** 2) Select "Properties"

** 3) Change the context root to the value you want it to have.

** 4) Deploy the web module.

Got it. Cool.

** To change the context root of a web module already deployed on a

** Tomcat server installation:

**

** 0) Go to the runtime tab in the Explorer

** 1) Expand the Server Registry node

** 2) Expand the installed Servers node

** 3) Expand the Tomcat node

** 4) Select the node corresponding to the server installation you are

**working with.

** 5) Right click the node and select stop server.

** 6) Expand the node to see the currently deployed web modules

** 7) Select "Properties" on a web module to change the context root

** 8) Restart the server

I guess my lame follow up question would be:

How do you deploy a web module?

I have a "web module" listed on my project defaults tab, is this not enough?

I even hit "deploy" on this web module, but I still don't have any "deployed

web modules" listed under my server (the only thing listed is hosts, and

then contexts)

What am I doing wrong? Sorry if this is obviously pointed out somewhere. I

honestly did RTFM but it seems slim on the topic of web modules, and

deployment kinds of things.

Davis,Noah at 2007-7-2 23:44:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 5

Noah Davis writes:

# How do you deploy a web module?

# I have a "web module" listed on my project defaults tab, is this not

# enough? I even hit "deploy" on this web module, but I still don't

# have any "deployed web modules" listed under my server (the only

# thing listed is hosts, and then contexts)

Apologies, I am so used to the confusing terminology that I forget to

mention this.

There is a lot of confusion here, all stemming from the Java Servlet

Specification. There are two concepts here: a) the collection of files (a

directory or archive) which make up a web module, and b) the running

entity of components that the Servlet container creates when (a) is

deployed.

(a) is referred to both as a "web module" and a "web application" in

the spec. In the IDE, we chose to use the term "web module" because

it's consistent with the EJB spec (which talks about "ejb modules").

One could argue that there isn't that much in it to separate the

notion of (a) from the notion of (b). Nevertheless, the API methods

for interacting with (b), the entity that the Servlet container

creates invariably refer to it as the ServletContext.

When you deploy a web module to the Tomcat server, you make an entry

in the server configuration file:

<Context path="<your context root>" docBase="<your web module>">

</Context>

This is no doubt why the people who implemented the Tomcat integration

module chose to refer to them as contexts. I will file an RFE that we

should make this less confusing.

So for all intents and purposes, you can treat "context" as meaning

"deployed web module".

Ana

vonKlopp,Ana at 2007-7-2 23:44:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...