Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Tomcat realm and Catalina conf
Tomcat realm and Catalina conf [message #94432] Sat, 23 April 2005 12:04 Go to next message
Eclipse UserFriend
Originally posted by: dharmamike.nospam.gmail.com

I am trying to include a Tomcat JDBCRealm in the context in which my
project runs. I add the realm to the server.xml for the instance of
Tomcat 5.0.28 registered in Eclipse for my project.

I noticed that each time I start the server from within Eclipse, it
propagates a new context XML file to the tomcat/conf/catalina/localhost
directory. That's not a problem; however, the context XML file contains
the context information for the project but NOT the realm information.

If I manually edit the context XML file, the realm specifications are
properly handled, but when I start Tomcat from inside Eclipse again, it
wipes them out with a new context XML file. This doesn't happen if I
start Tomcat outside of Eclipse.

Has anyone else experienced this? Any words of advice? Workarounds?

Thanks,
Mike

using tomcat 5.0.28
using ecliplse 3.1
using webtools 1.0M3
Re: Tomcat realm and Catalina conf [message #94449 is a reply to message #94432] Sat, 23 April 2005 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rajbsaini.yahoo.com

put context.xml file with your realm and other resouce definations in
your project's WebContents/META-INF folder. WTP will use this file in
the tomcat configration instead of its on context definations.


Raj
Mike Arnold wrote:
> I am trying to include a Tomcat JDBCRealm in the context in which my
> project runs. I add the realm to the server.xml for the instance of
> Tomcat 5.0.28 registered in Eclipse for my project.
>
> I noticed that each time I start the server from within Eclipse, it
> propagates a new context XML file to the tomcat/conf/catalina/localhost
> directory. That's not a problem; however, the context XML file contains
> the context information for the project but NOT the realm information.
>
> If I manually edit the context XML file, the realm specifications are
> properly handled, but when I start Tomcat from inside Eclipse again, it
> wipes them out with a new context XML file. This doesn't happen if I
> start Tomcat outside of Eclipse.
>
> Has anyone else experienced this? Any words of advice? Workarounds?
>
> Thanks,
> Mike
>
> using tomcat 5.0.28
> using ecliplse 3.1
> using webtools 1.0M3
Re: Tomcat realm and Catalina conf [message #94540 is a reply to message #94449] Sun, 24 April 2005 00:25 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Raj is correct that the best place to put this is in the
META-INF/context.xml. That way it is part of your project or web
module. In the I20050422 build, and eventually M4, context
configuration child elements will not be removed from server.xml unless
a META-INF/context.xml is found. This is an improvement from M3, where
the server.xml context child elements are always removed. The risk with
putting them in server.xml is that if you remove the project or web
module from the Tomcat server, the context and any child elements will
disappear from server.xml and be lost.

Cheers,
Larry


Raj Saini wrote:
> put context.xml file with your realm and other resouce definations in
> your project's WebContents/META-INF folder. WTP will use this file in
> the tomcat configration instead of its on context definations.
>
>
> Raj
> Mike Arnold wrote:
>
>> I am trying to include a Tomcat JDBCRealm in the context in which my
>> project runs. I add the realm to the server.xml for the instance of
>> Tomcat 5.0.28 registered in Eclipse for my project.
>>
>> I noticed that each time I start the server from within Eclipse, it
>> propagates a new context XML file to the
>> tomcat/conf/catalina/localhost directory. That's not a problem;
>> however, the context XML file contains the context information for the
>> project but NOT the realm information.
>>
>> If I manually edit the context XML file, the realm specifications are
>> properly handled, but when I start Tomcat from inside Eclipse again,
>> it wipes them out with a new context XML file. This doesn't happen if
>> I start Tomcat outside of Eclipse.
>>
>> Has anyone else experienced this? Any words of advice? Workarounds?
>>
>> Thanks,
>> Mike
>>
>> using tomcat 5.0.28
>> using ecliplse 3.1
>> using webtools 1.0M3
Re: Tomcat realm and Catalina conf [message #94624 is a reply to message #94540] Sun, 24 April 2005 20:42 Go to previous messageGo to next message
Andreas Schildbach is currently offline Andreas SchildbachFriend
Messages: 70
Registered: July 2009
Member
Larry Isaacs wrote:

> Raj is correct that the best place to put this is in the
> META-INF/context.xml. That way it is part of your project or web
> module. In the I20050422 build, and eventually M4, context
> configuration child elements will not be removed from server.xml unless
> a META-INF/context.xml is found. This is an improvement from M3, where
> the server.xml context child elements are always removed. The risk with
> putting them in server.xml is that if you remove the project or web
> module from the Tomcat server, the context and any child elements will
> disappear from server.xml and be lost.

The problem with putting them in META-INF/context.xml is that this
information is deployment specific and should not be contained in the
web application project itself.

On another Tomcat instance and/or version the resource definitions could
be totally different.

For JDBC DataSources it would perhaps be best if WTP would generate the
appropriate descriptor at deployment time, perhaps from the connection
information associated with the SQL server explorer? Don't know how to
deal with Realms and other resources, though.

Regards,

Andreas
Re: Tomcat realm and Catalina conf [message #94683 is a reply to message #94540] Mon, 25 April 2005 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marnold.nospam.dharmamike.com

So I gave this a shot. I cleared out all reference to my context in the
actual Tomcat server on my development system. Then, I removed the Tomcat
server from my project in Eclipse. I added the context XML to META-INF.
It contains only a context element and a child realm element. This is
exactly what's normally placed into
$CATALINA_HOME/conf/Catalina/localhost. I then added a Tomcat instance to
my project and built the project in Eclipse.

Here's what happened:
A server.xml was created in my project workspace as expected. The
server.xml contains a context element without the realm as a child element.
A context XML file was created in $CATALINA_HOME/conf/Catalina/localhost
with only a context element and without the realm.
The server starts, the page loads, and I am prompted to enter a username
and password, but the username and password don't resolve. It's clear
that the JDBCRealm is not actually being created.

Again, the JDBCRealm is being created if I do the work outside of Eclipse,
so I know that the XML specification is correct. It probably sounds
nit-picky since I have a workaround, but I'd really like to have Eclipse
be my one-stop shop for development on this project. It seems that it's
simply the placement of the files that I'm getting wrong. Any additional
help someone can provide would be much appreciated.

Thanks very much,
Mike Arnold


Larry Isaacs wrote:

> Raj is correct that the best place to put this is in the
> META-INF/context.xml. That way it is part of your project or web
> module. In the I20050422 build, and eventually M4, context
> configuration child elements will not be removed from server.xml unless
> a META-INF/context.xml is found. This is an improvement from M3, where
> the server.xml context child elements are always removed. The risk with
> putting them in server.xml is that if you remove the project or web
> module from the Tomcat server, the context and any child elements will
> disappear from server.xml and be lost.

> Cheers,
> Larry


> Raj Saini wrote:
>> put context.xml file with your realm and other resouce definations in
>> your project's WebContents/META-INF folder. WTP will use this file in
>> the tomcat configration instead of its on context definations.
>>
>>
>> Raj
>> Mike Arnold wrote:
>>
>>> I am trying to include a Tomcat JDBCRealm in the context in which my
>>> project runs. I add the realm to the server.xml for the instance of
>>> Tomcat 5.0.28 registered in Eclipse for my project.
>>>
>>> I noticed that each time I start the server from within Eclipse, it
>>> propagates a new context XML file to the
>>> tomcat/conf/catalina/localhost directory. That's not a problem;
>>> however, the context XML file contains the context information for the
>>> project but NOT the realm information.
>>>
>>> If I manually edit the context XML file, the realm specifications are
>>> properly handled, but when I start Tomcat from inside Eclipse again,
>>> it wipes them out with a new context XML file. This doesn't happen if
>>> I start Tomcat outside of Eclipse.
>>>
>>> Has anyone else experienced this? Any words of advice? Workarounds?
>>>
>>> Thanks,
>>> Mike
>>>
>>> using tomcat 5.0.28
>>> using ecliplse 3.1
>>> using webtools 1.0M3
Re: Tomcat realm and Catalina conf [message #94757 is a reply to message #94683] Mon, 25 April 2005 14:33 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Please check the context configuration found in the server.xml found
under the appropriate "tmp?" directory found under
"<workspace>/.metadata/.plugins/org.eclipse.wst.server.core ". This
is where your context config is really defined.

The context XML file written to conf/Catalina/localhost is sort of a bug
for contexts defined in server.xml. The context in server.xml takes
priority. Unfortunately, this file will interfere with normal usage of
the Tomcat installation. This behavior has been fixed in Tomcat 5.5,
which doesn't write this file.

There is still a problem of getting changes made to the
META-INF/context.xml file transferred to the server.xml under
".metadata/..." after the Tomcat server has been run the first time.
The handling isn't there to ensure the server realizes the need to
republish. You may have to remove and re-add the webapp to the server
so the server.xml gets rewritten with current data.

Cheers,
Larry


Mike Arnold wrote:
> So I gave this a shot. I cleared out all reference to my context in the
> actual Tomcat server on my development system. Then, I removed the
> Tomcat server from my project in Eclipse. I added the context XML to
> META-INF. It contains only a context element and a child realm
> element. This is exactly what's normally placed into
> $CATALINA_HOME/conf/Catalina/localhost. I then added a Tomcat instance
> to my project and built the project in Eclipse.
> Here's what happened: A server.xml was created in my project workspace
> as expected. The server.xml contains a context element without the
> realm as a child element.
> A context XML file was created in $CATALINA_HOME/conf/Catalina/localhost
> with only a context element and without the realm.
> The server starts, the page loads, and I am prompted to enter a username
> and password, but the username and password don't resolve. It's clear
> that the JDBCRealm is not actually being created.
> Again, the JDBCRealm is being created if I do the work outside of
> Eclipse, so I know that the XML specification is correct. It probably
> sounds nit-picky since I have a workaround, but I'd really like to have
> Eclipse be my one-stop shop for development on this project. It seems
> that it's simply the placement of the files that I'm getting wrong. Any
> additional help someone can provide would be much appreciated.
>
> Thanks very much,
> Mike Arnold
>
>
> Larry Isaacs wrote:
>
>> Raj is correct that the best place to put this is in the
>> META-INF/context.xml. That way it is part of your project or web
>> module. In the I20050422 build, and eventually M4, context
>> configuration child elements will not be removed from server.xml
>> unless a META-INF/context.xml is found. This is an improvement from
>> M3, where the server.xml context child elements are always removed.
>> The risk with putting them in server.xml is that if you remove the
>> project or web module from the Tomcat server, the context and any
>> child elements will disappear from server.xml and be lost.
>
>
>> Cheers,
>> Larry
>
>
>
>> Raj Saini wrote:
>>
>>> put context.xml file with your realm and other resouce definations
>>> in your project's WebContents/META-INF folder. WTP will use this file
>>> in the tomcat configration instead of its on context definations.
>>>
>>>
>>> Raj
>>> Mike Arnold wrote:
>>>
>>>> I am trying to include a Tomcat JDBCRealm in the context in which my
>>>> project runs. I add the realm to the server.xml for the instance of
>>>> Tomcat 5.0.28 registered in Eclipse for my project.
>>>>
>>>> I noticed that each time I start the server from within Eclipse, it
>>>> propagates a new context XML file to the
>>>> tomcat/conf/catalina/localhost directory. That's not a problem;
>>>> however, the context XML file contains the context information for
>>>> the project but NOT the realm information.
>>>>
>>>> If I manually edit the context XML file, the realm specifications
>>>> are properly handled, but when I start Tomcat from inside Eclipse
>>>> again, it wipes them out with a new context XML file. This doesn't
>>>> happen if I start Tomcat outside of Eclipse.
>>>>
>>>> Has anyone else experienced this? Any words of advice? Workarounds?
>>>>
>>>> Thanks,
>>>> Mike
>>>>
>>>> using tomcat 5.0.28
>>>> using ecliplse 3.1
>>>> using webtools 1.0M3
>
>
Previous Topic:Setting up a project with strange structure
Next Topic:HttpServlet "cannot be resolved to a type"
Goto Forum:
  


Current Time: Thu Dec 26 11:27:43 GMT 2024

Powered by FUDForum. Page generated in 0.03996 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top