Tomcat context-specific XML files now possible!

It used to be you had to edit the server.xml to add a context path. now it seems that Pallada picks up on Catalina/localhost/xxx.xml files based on the context you're calling in the tomcat settings.

To try it:

setup a web app run setting with /myapp in the context, although this path does not exit in server.xml and won't show up in the drop down, you can still type in anything you want.

then go to <tomcat-root>/conf/Catalina/localhost and copy manager.xml to myapp.xml and edit it. I would remove the docBase, turn on debugging.

Now run your app in idea.

JB, is this intended to work, or did I discover this by sheer luck?

R

10 comments
Comment actions Permalink

Well, this is a standard tomcat 5 feature, isn't it?

0
Comment actions Permalink

Yes but it used to not work. Now idea actually looks for it. So you can actually make the exploded web dir point into Tomcat's webapp dir with your application's name, and add this file to Catalina and IDEA will actually copy it into its own temporary directory and honor the settings in it.

Used to be you could not do any of that.

R

0
Comment actions Permalink

That's better, but you are still forced to create the context xml file
on your own. If the file does not exist, it already has all the
information it needs to create the file. Here is another question, how
come nothing shows up in the drop-down?

Norris Shelton
Sun Certified Java Programmer




Robert S. Sfeir wrote:

>Yes but it used to not work. Now idea actually looks for it. So you can actually make the exploded web dir point into Tomcat's webapp dir with your application's name, and add this file to Catalina and IDEA will actually copy it into its own temporary directory and honor the settings in it.
>
>Used to be you could not do any of that.
>
>R

>

0
Comment actions Permalink

Having looked closely at the Tomcat code, the reason why the dropdown is empty is because JB only parses server.xml for contexts. It doesn't look at the Catalina/local dir for more .xml files and assume context information from there. That would be helpful.

That said, the fact that it picks up the file is only half the battle. the problem is that the application doesn't load properly anyway, for this to work, you exloded directory needs to be in the Tomcat webapp dir. they need to pickup, or let us choose a relevant XML file and use that as a basis for loading the context for Tomcat. This way we can tweak the context file along with the app.

R

0
Comment actions Permalink

Here is a follow up question. Once it is working (mine is not), does
your webapp code require the context name in every URL?

Like /mycontext/index.jsp or can it be accessed like /index.jsp?

We have our tomcats (4.1 for now) configured with a service for each
webapp with a context element for the target, along with the manager
webapp (took an act of "god"). Then each webapp has it's own port(s).

http://localhost:9001 it how I address one of my webapps. This allows
it to be accessed via /, instead of /mycontext/.

This also works with TC5 (yes, I'm a rebel).

Norris Shelton
Sun Certified Java Programmer




Robert S. Sfeir wrote:

>Having looked closely at the Tomcat code, the reason why the dropdown is empty is because JB only parses server.xml for contexts. It doesn't look at the Catalina/local dir for more .xml files and assume context information from there. That would be helpful.
>
>That said, the fact that it picks up the file is only half the battle. the problem is that the application doesn't load properly anyway, for this to work, you exloded directory needs to be in the Tomcat webapp dir. they need to pickup, or let us choose a relevant XML file and use that as a basis for loading the context for Tomcat. This way we can tweak the context file along with the app.
>
>R

>

0
Comment actions Permalink

Thanks for the pointer. We have the deploy directory in a RAM disk. IDEA doesnt seem to pick the deployment descriptor eben though we have specified docbase in the application-context.xml.

Any ideas?

Venkatesh

Hello Robert,

It used to be you had to edit the server.xml to add a context path.
now it seems that Pallada picks up on Catalina/localhost/xxx.xml files
based on the context you're calling in the tomcat settings.

To try it:

setup a web app run setting with /myapp in the context, although this
path does not exit in server.xml and won't show up in the drop down,
you can still type in anything you want.

then go to <tomcat-root>/conf/Catalina/localhost and copy manager.xml
to myapp.xml and edit it. I would remove the docBase, turn on
debugging.

Now run your app in idea.

JB, is this intended to work, or did I discover this by sheer luck?

R


0
Comment actions Permalink

Hello Robert,

It used to be you had to edit the server.xml to add a context path.
now it seems that Pallada picks up on Catalina/localhost/xxx.xml files
based on the context you're calling in the tomcat settings.

To try it:

setup a web app run setting with /myapp in the context, although this
path does not exit in server.xml and won't show up in the drop down,
you can still type in anything you want.

then go to <tomcat-root>/conf/Catalina/localhost and copy manager.xml
to myapp.xml and edit it. I would remove the docBase, turn on
debugging.

Now run your app in idea.

JB, is this intended to work, or did I discover this by sheer luck?

R

Are you able to debug (set breakpoints) when trying to debug webapps. I get an UnSupportedOperation exception. (http://www.intellij.net/tracker/idea/viewSCR?publicId=32404 )

Thanks,
--Venkat.

0
Comment actions Permalink

Actually I am able to startup in Debug mode, but when I set a breakpoint I get a nasty exception, so I am not able to debug and the app server doesn't stop at the breakpoint when it hits it, though the breakpoint is right there.

R

0
Comment actions Permalink

Hello Robert,

Actually I am able to startup in Debug mode, but when I set a
breakpoint I get a nasty exception, so I am not able to debug and the
app server doesn't stop at the breakpoint when it hits it, though the
breakpoint is right there.

R

Thanks for the response. I am also having the exact same behaviour. Did you open any issues? If not, can you also please vote the issue I have opened up.

In the past I have seen JB respond to your posts. Can you urge them to fix this? This is pretty irritating (I know this EAP but at the same time feel it is very basic behavior) at not being able to debug web-apps.

Thanks,
--Venkat.

0
Comment actions Permalink

Venkat,

I've reported it through the bug tool. So it's in there I think 2-3 times. I don't need to urge them to fix it, it's an exception which they'll fix I'm sure :)

R

0

Please sign in to leave a comment.