Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Example of a custom {ContextPath}.xml file
Example of a custom {ContextPath}.xml file [message #1143828] Fri, 18 October 2013 12:58 Go to next message
William Suetholz is currently offline William SuetholzFriend
Messages: 5
Registered: October 2013
Junior Member
Hello,
We have a servlet that in the past we documented changing the unpacked web.xml file to set custom parameters. In Virgo that solution is unworkable, since we don't have easy access to an unpacked web.xml. I was reading that in order to set a custom context, you need to put a file in the configuration/Catalina/localhost directory named for the servlet context path. If my servlet context path shows in the Virgo bundle as /app then the context file should be app.xml is my understanding. So, being that I'm not much of a servlet designer and have some rather wide gaps in my understanding, thought that just copying the web.xml to app.xml in the proper location would be enough to give me a customizable servlet. But, while I see the file being read in the debug logs, it gives a warning for each element saying that it doesn't understand it.. Actual message is "org.apache.tomcat.util.digester.Digester No rules found matching 'web-app/servlet/init-param'" for every element in the file.

So, I assume I'm missing something that I should just "know", but I don't. Can somebody point out what I'm missing, and the proper format of this context file please?

I have looked through the examples and if its there I've missed it.

I have been seeing that the way that Virgo wants these kind of customizations is with a configuration class supplying beans, but this servlet needs to be able to play nice with any other servlet container, and while we've done some minor changes to produce a jar bundle as well as the normal war, I don't see how switching the configuration to osgi beans would be portable.

Thank you in advance for any advice given....
Bill S.
Re: Example of a custom {ContextPath}.xml file [message #1143909 is a reply to message #1143828] Fri, 18 October 2013 14:02 Go to previous messageGo to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 61
Registered: July 2009
Member
Hi Bill,

I don't know if it is possible to move servlet init parameters to a Tomcat context file, but if you don't mind making a little modification to your servlet you could use context parameters instead of servlet init parameters for initialization: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Context_Parameters

GianMaria.


Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Re: Example of a custom {ContextPath}.xml file [message #1148216 is a reply to message #1143828] Mon, 21 October 2013 10:55 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 244
Registered: October 2010
Senior Member
Hi,

Quote:

We have a servlet that in the past we documented changing the unpacked web.xml file to set custom parameters. In Virgo that solution is unworkable, since we don't have easy access to an unpacked web.xml. I was reading that in order to set a custom context, you need to put a file in the configuration/Catalina/localhost


You are mixing the things a lot.
What do you mean - web.xml or context.xml.
There is no such feature in Tomcat that web.xml to be copied to configuration/Catalina/localhost. Only the context.xml is copied to that directory.

Quote:

I was reading that in order to set a custom context, you need to put a file in the configuration/Catalina/localhost directory named for the servlet context path. If my servlet context path shows in the Virgo bundle as /app then the context file should be app.xml is my understanding.


Please read carefully the documentation [1].

Quote:

Note that the following context configuration features are not supported in Virgo Server for Apache Tomcat:

Custom class loaders.

Specifying the context path. This is specified using the Web-ContextPath header in the web application's MANIFEST.MF file.

Specifying the document base directory.


Regards
Violeta

[1] http://eclipse.org/virgo/documentation/virgo-documentation-3.6.2.RELEASE/docs/virgo-user-guide/htmlsingle/virgo-user-guide.html#configuring-tomcat -> Chapter "Context Configuration"
Re: Example of a custom {ContextPath}.xml file [message #1148553 is a reply to message #1143909] Mon, 21 October 2013 15:42 Go to previous messageGo to next message
William Suetholz is currently offline William SuetholzFriend
Messages: 5
Registered: October 2013
Junior Member
Thank you, that looks like what we need to do.
Re: Example of a custom {ContextPath}.xml file [message #1148556 is a reply to message #1148216] Mon, 21 October 2013 15:44 Go to previous message
William Suetholz is currently offline William SuetholzFriend
Messages: 5
Registered: October 2013
Junior Member
Violeta Georgieva wrote on Mon, 21 October 2013 06:55
Hi,

Quote:

We have a servlet that in the past we documented changing the unpacked web.xml file to set custom parameters. In Virgo that solution is unworkable, since we don't have easy access to an unpacked web.xml. I was reading that in order to set a custom context, you need to put a file in the configuration/Catalina/localhost


You are mixing the things a lot.
What do you mean - web.xml or context.xml.
There is no such feature in Tomcat that web.xml to be copied to configuration/Catalina/localhost. Only the context.xml is copied to that directory.


Thank you, yes I knew I was mixing things up.. Your response plus the other response I believe will be enough to help me unmix things.

Previous Topic:Bundles inside plans are started concurrently, causing problems
Next Topic:Virgo OSGi with custom Vaadin component IncompatibleClassChangeError
Goto Forum:
  


Current Time: Fri Nov 28 08:54:25 GMT 2014

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

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