tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Ee" <and...@sysatwork.com>
Subject RE: Multi-Level Context Paths
Date Tue, 18 Aug 2009 15:46:08 GMT
Dear all,

I reported having problem deploying my war file with multi-level context
path on Tomcat 6.0.20. Beside the sitemesh issue, is it possible that the
problem be due to JDK 1.5 or Java 5, that has issue understanding the symbol
'#' in war filename.

Ref: https://issues.apache.org/bugzilla/show_bug.cgi?id=43150

The bug is said to be fixed from v6.0.17 onwards though.

I would appreciate if anybody can tell if he/she has successfully deployed
with multi-level context path.

I tried having the context element (given below) inside server.xml and the
multi-level context path works!

<Context path="/sg/server/test" docBase="test" reloadable="true"
crossContext="false" allowLinking="true" />

However, Tomcat 6 deploys the war file twice every time it starts up. It
could be due to context element being defined under server.xml and
Catalina/localhost/xxx.xml. So this method needs tweaking afterall.


Thank you.

Best Regards,
Andy Ee
 
 

-----Original Message-----
From: Ognjen Blagojevic [mailto:ognjen@etf.bg.ac.rs] 
Sent: Monday, August 17, 2009 7:54 PM
To: Tomcat Users List
Subject: Re: Multi-Level Context Paths

Try here:

   http://www.opensymphony.com/sitemesh/userForums.action

Regards,
Ognjen

Andy Ee wrote:
> Hi Ognjen,
> 
> Are you able to advice the mailing list for sitemesh? Is it under Tomcat
as
> well?
> 
> Best Regards,
> Andy Ee
>  
>  
> 
> -----Original Message-----
> From: Ognjen Blagojevic [mailto:ognjen@etf.bg.ac.rs] 
> Sent: Monday, August 17, 2009 7:31 PM
> To: Tomcat Users List
> Subject: Re: Multi-Level Context Paths
> 
> Hi Andy,
> 
> On Tomcat side everything seems to work just fine.
> 
> It seems that sitemash (wrongly) assumes the location of the file config 
> file. Try on sitemesh forum/mailing list.
> 
>  > Caused by: com.opensymphony.module.sitemesh.factory.FactoryException: 
> Could
>  > not read config file : /WEB-INF/sitemesh.xml: 
> java.io.FileNotFoundException:
>  > /usr/local/apache-tomcat/webapps/sg (No such file or directory)
> 
> Regards,
> Ognjen
> 
> 
> Andy Ee wrote:
>> Hi Ognjen,
>>
>>  
>>
>> Thank you for your quick response!
>>
>>  
>>
>> I have undeployed the old application (test.war) under Tomcat Manager, as
>> well as renamed test.war to sg#server#test.war under webapps. Without the
>> need to restart Tomcat, I saw the new project directory created under
>> /webapps/sg#server#test after awhile.
>>
>>  
>>
>> I tried to access http://localhost:8080/sg/server/test but it doesn't
> work.
>>  
>>
>> Under catalina.out log:
>>
>>  
>>
>> INFO: Undeploying context [/test]
>>
>> Aug 17, 2009 6:57:24 PM org.apache.catalina.startup.HostConfig deployWAR
>>
>> INFO: Deploying web application archive sg#server#test.war
>>
>> [test] DEBUG [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> StartupListener.contextInitialized(44) | initializing context...
>>
>> AbandonedObjectPool is used
>> (org.apache.commons.dbcp.AbandonedObjectPool@169be56)
>>
>>    LogAbandoned: false
>>
>>    RemoveAbandoned: true
>>
>>    RemoveAbandonedTimeout: 60
>>
>> [test] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> DefaultValidatorFactory.setValidationConfigLocations(78) | Loading
>> validation configurations from [ServletContext resource
>> [/WEB-INF/validation.xml],ServletContext resource
>> [/WEB-INF/validator-rules.xml],ServletContext resource
>> [/WEB-INF/validator-rules-custom.xml]]
>>
>> [test] DEBUG [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> MS3Crypto.initParams(53) | Initializing crypto parameters.
>>
>> [test] DEBUG [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> MS3Crypto.initParams(80) | Raw Seed : [B@87c801
>>
>> [test] DEBUG [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> StartupListener.contextInitialized(95) | Remember Me Enabled? null
>>
>> [test] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> LocaleFilter.init(152) | Initializing filter 'localeFilter'
>>
>> [test] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> LocaleFilter.init(177) | Filter 'localeFilter' configured successfully
>>
>> [test] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> GZIPFilter.init(152) | Initializing filter 'compressionFilter'
>>
>> [test] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
>> GZIPFilter.init(177) | Filter 'compressionFilter' configured successfully
>>
>> Aug 17, 2009 6:57:44 PM org.apache.catalina.core.StandardContext start
>>
>> SEVERE: Error filterStart
>>
>> Aug 17, 2009 6:57:44 PM org.apache.catalina.core.StandardContext start
>>
>> SEVERE: Context [/singapore/dbs/test] startup failed due to previous
> errors
>>  
>>
>> Under localhost log:
>>
>>  
>>
>> Aug 17, 2009 6:57:44 PM org.apache.catalina.core.StandardContext
> filterStart
>> SEVERE: Exception starting filter sitemesh
>>
>> com.opensymphony.module.sitemesh.factory.FactoryException: Cannot
> construct
>> Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory:
>> java.lang.reflect.InvocationTargetException
>>
>>         at
> com.opensymphony.module.sitemesh.Factory.report(Factory.java:87)
>>         at
>> com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:56)
>>
>>         at
>>
>
com.opensymphony.module.sitemesh.filter.PageFilter.init(PageFilter.java:86)
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
>> Config.java:275)
>>
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFil
>> terConfig.java:397)
>>
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
>> fig.java:108)
>>
>>         at
>>
>
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:38
>> 00)
>>
>>         at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
>> 91)
>>
>>         at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>>
>>         at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
>>
>>         at
>>
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
>>
>>         at
>>
>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
>> t.java:119)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:
>> 1337)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
>> hildren(ContainerBase.java:1601)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
>> hildren(ContainerBase.java:1610)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
>> ainerBase.java:1590)
>>
>>         at java.lang.Thread.run(Thread.java:619)
>>
>>  
>>
>> Root cause:
>>
>> java.lang.reflect.InvocationTargetException
>>
>>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>
>>         at
>>
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
>> sorImpl.java:39)
>>
>>         at
>>
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
>> torAccessorImpl.java:27)
>>
>>         at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>
>>         at
>> com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:52)
>>
>>         at
>>
>
com.opensymphony.module.sitemesh.filter.PageFilter.init(PageFilter.java:86)
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
>> Config.java:275)
>>
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFil
>> terConfig.java:397)
>>
>>         at
>>
>
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
>> fig.java:108)
>>
>>         at
>>
>
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:38
>> 00)
>>
>>         at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
>> 91)
>>
>>         at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>>
>>         at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
>>
>>         at
>> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
>>
>>         at
>>
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
>>
>>         at
>>
>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
>> t.java:119)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:
>> 1337)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
>> hildren(ContainerBase.java:1601)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
>> hildren(ContainerBase.java:1610)
>>
>>         at
>>
>
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
>> ainerBase.java:1590)
>>
>>         at java.lang.Thread.run(Thread.java:619)
>>
>> Caused by: com.opensymphony.module.sitemesh.factory.FactoryException:
> Could
>> not read config file : /WEB-INF/sitemesh.xml:
> java.io.FileNotFoundException:
>> /usr/local/apache-tomcat/webapps/sg (No such file or directory)
>>
>>         at
> com.opensymphony.module.sitemesh.Factory.report(Factory.java:87)
>>         at
>>
>
com.opensymphony.module.sitemesh.factory.DefaultFactory.loadConfig(DefaultFa
>> ctory.java:131)
>>
>>         at
>>
>
com.opensymphony.module.sitemesh.factory.DefaultFactory.<init>(DefaultFactor
>> y.java:57)
>>
>>         ... 25 more
>>
>> Aug 17, 2009 6:57:44 PM org.apache.catalina.core.ApplicationContext log
>>
>> INFO: Closing Spring root WebApplicationContext
>>
>>  
>>
>>  
>>
>> Any idea? Thanks.
>>
>>  
>>
>> Best Regards,
>> Andy Ee
>>
>>
>>
>>
>> -----Original Message-----
>> From: Ognjen Blagojevic [mailto:ognjen@etf.bg.ac.rs] 
>> Sent: Monday, August 17, 2009 7:00 PM
>> To: Tomcat Users List
>> Subject: Re: Multi-Level Context Paths
>>
>>  
>>
>> Hi Andy,
>>
>>  
>>
>> Try to undeploy the old application. Rename the test.war to 
>>
>> sg#server#test.war, and deploy it.
>>
>>  
>>
>> Regards,
>>
>> Ognjen
>>
>>  
>>
>> Andy Ee wrote:
>>
>>>  
>>
>>> Dear All,
>>
>>>  
>>
>>> I need an urgent help, and I hope you will shed some light to it.
>>
>>>  
>>
>>> I have recently installed Apache Tomcat version 6.0.20. I copied my
>> project
>>
>>> file (test.war) under /usr/local/apache-tomcat-6.0.20/webapps/ and it
>>> deployed successfully. I can access the site via the URL of
>>> <http://localhost:8080/ms3/> http://localhost:8080/test/. For this
>> example,
>>
>>> the context path simply follows the filename of the war file.
>>
>>>  
>>
>>> There is a new requirement to setup multi-level context path as in I
need
>>> the URL to be  <http://localhost:8080/sg/server/test/>
>>> http://localhost:8080/sg/server/test/ instead. I read up your site and
>>> confirmed that adding Context path within server.xml is not recommended.
> I
>>> went ahead to make a copy of the existing test.xml to sg#server#test.xml
>>> under /usr/local/apache-tomcat-6.0.20/conf/Catalina/localhost/. Then I
>>> restarted Tomcat.
>>
>>>  
>>
>>> The content of sg#server#test is:
>>
>>>  
>>
>>> <Context path="/test" debug="99" reloadable="true"
>>
>>>     antiJARLocking="true" antiResourceLocking="false">
>>
>>>  
>>
>>>     <!--Resource name="jdbc/test" auth="Container"
>>> type="javax.sql.DataSource"
>>
>>>               maxActive="100" maxIdle="30" maxWait="10000"
>>
>>>               driverClassName="oracle.jdbc.driver.OracleDriver"
>>
>>>               username="MS3_STL" password="password"
>>
>>>               url="jdbc:oracle:thin:@192.168.0.37:1521:MS3"
>>
>>>               defaultAutoCommit="true" removeAbandoned="true"
>>
>>>               removeAbandonedTimeout="60" logAbandoned="true"/-->
>>
>>> </Context>
>>
>>>  
>>
>>> I restarted Tomcat but it gives errors under Catalina.out
>>
>>>  
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.core.StandardContext
>>> resourcesStart
>>
>>> SEVERE: Error starting static Resources
>>
>>> java.lang.IllegalArgumentException: Document base
>>> /usr/local/apache-tomcat/webapps/sg#server#test does not exist or is not
> a
>>> readable directory
>>
>>>         at
>>
>
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:14
>>> 2)
>>
>>>         at
>>
>
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java
>>> :4048)
>>
>>>         at
>>>
org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
>>
>>>         at
>>
>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
>>> 91)
>>
>>>         at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>>
>>>         at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
>>
>>>         at
>>
>
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
>>
>>>         at
>>
>
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556
>>> )
>>
>>>         at
>>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
>>
>>>         at
>>> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
>>
>>>         at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
>>
>>>         at
>>
>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
>>> t.java:119)
>>
>>>         at
>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>>
>>>         at
>>> org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
>>
>>>         at
>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>>
>>>         at
>>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>>
>>>         at
>>> org.apache.catalina.core.StandardService.start(StandardService.java:516)
>>
>>>         at
>>> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>>
>>>         at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
>>
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>>>         at
>>
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>>> )
>>
>>>         at
>>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>>> .java:25)
>>
>>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>
>>>         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>>
>>>         at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.core.StandardContext start
>>
>>> SEVERE: Error in resourceStart()
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.core.StandardContext start
>>
>>> SEVERE: Error getConfigured
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.core.StandardContext start
>>
>>> SEVERE: Context [/sg/server/test] startup failed due to previous errors
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.core.StandardContext stop
>>
>>> INFO: Container
>>
>
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sg/server/te
>>> st] has not been started
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.coyote.http11.Http11Protocol start
>>
>>> INFO: Starting Coyote HTTP/1.1 on http-6060
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.coyote.http11.Http11Protocol start
>>
>>> INFO: Starting Coyote HTTP/1.1 on http-6443
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.jk.common.ChannelSocket init
>>
>>> INFO: JK: ajp13 listening on /0.0.0.0:6009
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.jk.server.JkMain start
>>
>>> INFO: Jk running ID=0 time=0/40  config=null
>>
>>> Aug 17, 2009 5:54:43 PM org.apache.catalina.startup.Catalina start
>>
>>> INFO: Server startup in 18859 ms
>>
>>>  
>>
>>> I have searched the Internet and couldn't find any posts with solutions
> to
>>> such issue. It seems that setting up multi-level context path in Tomcat
6
>> is
>>
>>> not so straight-forwarded.
>>
>>>  
>>
>>> Please kindly help, thanks.
>>
>>>  
>>
>>> Best Regards,
>>> Andy Ee
>>
>>
>>
>>>  
>>
>>>  
>>
>>
>>  
>>
>>  
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>  
>>
>>  
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message