You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Schulze, Jan" <Ja...@verwaltung.uni-tuebingen.de> on 2014/04/21 13:49:40 UTC
Deploying a Grails WAR (non-OSGI) in Karaf
Hi all,
I am trying to deploy a very simple Grails webapp as a WAR (non-OSGI) in Karaf. It's the "Hello World" example from the Grails introduction at http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExample
In the Grails testing environment it is working with both Tomcat and Jetty as container. When dropping the WAR into Karaf (with WAR-feature installed), I am getting the following exception:
2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld - 0.1.0 | Plugin [logging:2.3.7] is participating in Spring configuration...
2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld - 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring configuration...
2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 280 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | getting resource: [/]
2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 292 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | not a URL or invalid URL: [/], treating as a file path
2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 113 | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Searching bundle [helloworld [173]] for resource [], normalized to [/]
2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 142 | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Resource not found
2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 321 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | found resource: null
2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace | ptions.DefaultStackTraceFilterer 105 | 173 - helloworld - 0.1.0 | Full Stack Trace:
java.io.FileNotFoundException: ServletContext resource [/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:154)[173:helloworld:0.1]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:411)[173:helloworld:0.1]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:340)[173:helloworld:0.1]
I have been looking at the Grails configuration and the Jetty/Pax configuration, but I wasn't able to make any progress.
The Grails webapp should automatically be available at the URL http://localhost:8181/helloworld. So I thought, that it might have something to do with Pax picking up the resource "/" instead of "helloworld".
I tried changing the grails.app.context and the Webapp-Context in the WAR's MANIFEST.MF, and I also tried deploying the webapp as ROOT.war, but without success.
Any suggestions?
Regards,
Jan
Re: Deploying a Grails WAR (non-OSGI) in Karaf
Posted by Charlie Mordant <cm...@gmail.com>.
Hi,
I don't know if it's a valuable answer, but maybe the WebApp-Context
Manifest entry would help:
https://ops4j1.jira.com/wiki/display/ops4j/Pax+Web+Extender+-+War+-+FAQ
I remember an old entry of how to do this in a feature.xml too.
Regards,
2014-04-21 13:49 GMT+02:00 Schulze, Jan <
Jan.Schulze@verwaltung.uni-tuebingen.de>:
> Hi all,
>
> I am trying to deploy a very simple Grails webapp as a WAR (non-OSGI) in
> Karaf. It's the "Hello World" example from the Grails introduction at
> http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExample
>
> In the Grails testing environment it is working with both Tomcat and Jetty
> as container. When dropping the WAR into Karaf (with WAR-feature
> installed), I am getting the following exception:
>
> 2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin
> | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld -
> 0.1.0 | Plugin [logging:2.3.7] is participating in Spring configuration...
> 2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin
> | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld -
> 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring configuration...
> 2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 | HttpServiceContext
> | rnal.HttpServiceContext$SContext 280 | 118 -
> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | getting resource: [/]
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | HttpServiceContext
> | rnal.HttpServiceContext$SContext 292 | 118 -
> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | not a URL or invalid URL: [/],
> treating as a file path
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
> WebAppWebContainerContext | r.war.internal.WebAppHttpContext 113 |
> 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Searching bundle
> [helloworld [173]] for resource [], normalized to [/]
> 2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 |
> WebAppWebContainerContext | r.war.internal.WebAppHttpContext 142 |
> 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Resource not found
> 2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 | HttpServiceContext
> | rnal.HttpServiceContext$SContext 321 | 118 -
> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | found resource: null
> 2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace
> | ptions.DefaultStackTraceFilterer 105 | 173 - helloworld -
> 0.1.0 | Full Stack Trace:
> java.io.FileNotFoundException: ServletContext resource [/] cannot be
> resolved to URL because it does not exist
> at
> org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:154)[173:helloworld:0.1]
> at
> org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:411)[173:helloworld:0.1]
> at
> org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:340)[173:helloworld:0.1]
>
> I have been looking at the Grails configuration and the Jetty/Pax
> configuration, but I wasn't able to make any progress.
>
> The Grails webapp should automatically be available at the URL
> http://localhost:8181/helloworld. So I thought, that it might have
> something to do with Pax picking up the resource "/" instead of
> "helloworld".
> I tried changing the grails.app.context and the Webapp-Context in the
> WAR's MANIFEST.MF, and I also tried deploying the webapp as ROOT.war, but
> without success.
>
> Any suggestions?
>
>
> Regards,
> Jan
AW: Deploying a Grails WAR (non-OSGI) in Karaf
Posted by "Schulze, Jan" <Ja...@verwaltung.uni-tuebingen.de>.
Hi all,
sorry for not getting back to you sooner, but thanks for all your answers! They helped me to sort some things out. I had to do some reading about what directives need to go into the MANIFEST.MF to make the bundle OSGi-compliant. And I had not known about the various deployment possibilities in Karaf.
I was not able to solve the problem yet, but I found out that I was probably looking at the wrong place. I was suspecting the lines leading up to the exception to be a problem:
2014-04-24 09:06:12,820 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 280 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | getting resource: [/]
2014-04-24 09:06:12,835 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 292 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | not a URL or invalid URL: [/], treating as a file path
2014-04-24 09:06:12,835 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 113 | 170 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Searching bundle [helloworld [213]] for resource [], normalized to [/]
2014-04-24 09:06:12,835 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 142 | 170 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Resource not found
2014-04-24 09:06:12,835 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 321 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | found resource: null
But then I saw the same messages when deploying the sample war from http://tomcat.apache.org/tomcat-5.5-doc/appdev/sample/sample.war, which is working flawlessly.
Also, the exception:
java.io.FileNotFoundException: ServletContext resource [/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:154)[214:file_C__helloworld-0.1.war:0]
... is always there, regardless of the MANIFEST.MF contents and regardless of the method of deployment.
I will have to look into the Spring Framework or the Grails internals.
Regards,
--
Jan Schulze
> -----Ursprüngliche Nachricht-----
> Von: Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
> Gesendet: Montag, 21. April 2014 19:03
> An: user@karaf.apache.org
> Betreff: Re: Deploying a Grails WAR (non-OSGI) in Karaf
>
> Thanks Achim, it's what I meant by wrap (wrap == webbundle in my mind ;)).
>
> Regards
> JB
>
> On 04/21/2014 07:01 PM, Achim Nierbeck wrote:
> > Hi all,
> >
> > this is not true for all parts ;)
> >
> > If you deploy your WAR in the deploy folder Pax Web will create a OSGi
> > War of it, if you want to deploy it via the shell you'll need to deploy
> > it via the webbundle: url-prefix this will also wrap it to a OSGi War,
> > also with this it is needed to specify the Web-ContextPath otherwise
> > this installment doesn't work. This is also true if you deploy it via a
> > feature.xml you'll need to add the webbundle: prefix and the
> > Web-ContextPath via the URL for example:
> >
> > webbundle:mvn:groupID/artifactID/version/war?Web-
> ContextPath=myApp
> >
> >
> > regards, Achim
> >
> >
> >
> >
> > 2014-04-21 18:54 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net
> > <ma...@nanthrax.net>>:
> >
> > Hi Jan,
> >
> > "pure" non OSGi war file deployment are not supported.
> >
> > The war has to contain at least WebApp-Context in the MANIFEST.
> >
> > You can use wrap on top of the war to do that, or add in your war.
> >
> > Regards
> > JB
> >
> >
> > On 04/21/2014 01:49 PM, Schulze, Jan wrote:
> >
> > Hi all,
> >
> > I am trying to deploy a very simple Grails webapp as a WAR
> > (non-OSGI) in Karaf. It's the "Hello World" example from the
> > Grails introduction at
> >
> http://grails.org/doc/latest/__guide/gettingStarted.html#__aHelloWorldExa
> mple
> >
> <http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExampl
> e>
> >
> > In the Grails testing environment it is working with both Tomcat
> > and Jetty as container. When dropping the WAR into Karaf (with
> > WAR-feature installed), I am getting the following exception:
> >
> > 2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 |
> > DefaultGrailsPlugin |
> > ails.plugins.__DefaultGrailsPlugin 498 | 173 - helloworld -
> > 0.1.0 | Plugin [logging:2.3.7] is participating in Spring
> > configuration...
> > 2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 |
> > DefaultGrailsPlugin |
> > ails.plugins.__DefaultGrailsPlugin 498 | 173 - helloworld -
> > 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring
> > configuration...
> > 2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 |
> > HttpServiceContext |
> > rnal.HttpServiceContext$__SContext 280 | 118 -
> > org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | getting resource: [/]
> > 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
> > HttpServiceContext |
> > rnal.HttpServiceContext$__SContext 292 | 118 -
> > org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | not a URL or
> > invalid URL: [/], treating as a file path
> > 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
> > WebAppWebContainerContext |
> > r.war.internal.__WebAppHttpContext 113 | 166 -
> > org.ops4j.pax.web.pax-web-__extender-war - 1.1.16 | Searching
> > bundle [helloworld [173]] for resource [], normalized to [/]
> > 2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 |
> > WebAppWebContainerContext |
> > r.war.internal.__WebAppHttpContext 142 | 166 -
> > org.ops4j.pax.web.pax-web-__extender-war - 1.1.16 | Resource not
> > found
> > 2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 |
> > HttpServiceContext |
> > rnal.HttpServiceContext$__SContext 321 | 118 -
> > org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | found resource: null
> > 2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace
> > | ptions.__DefaultStackTraceFilterer 105
> > | 173 - helloworld - 0.1.0 | Full Stack Trace:
> > java.io.FileNotFoundException: ServletContext resource [/]
> > cannot be resolved to URL because it does not exist
> > at
> >
> org.springframework.web.__context.support.__ServletContextResource.ge
> tURL(__ServletContextResource.java:__154)[173:helloworld:0.1]
> > at org.springframework.core.io
> >
> <http://org.springframework.core.io>.__support.__PathMatchingResource
> PatternRes__olver.isJarResource(__PathMatchingResourcePatternRes__olv
> er.java:411)[173:__helloworld:0.1]
> > at org.springframework.core.io
> >
> <http://org.springframework.core.io>.__support.__PathMatchingResource
> PatternRes__olver.__findPathMatchingResources(__PathMatchingResource
> PatternRes__olver.java:340)[173:__helloworld:0.1]
> >
> > I have been looking at the Grails configuration and the
> > Jetty/Pax configuration, but I wasn't able to make any progress.
> >
> > The Grails webapp should automatically be available at the URL
> > http://localhost:8181/__helloworld
> > <http://localhost:8181/helloworld>. So I thought, that it might
> > have something to do with Pax picking up the resource "/"
> > instead of "helloworld".
> > I tried changing the grails.app.context and the Webapp-Context
> > in the WAR's MANIFEST.MF, and I also tried deploying the webapp
> > as ROOT.war, but without success.
> >
> > Any suggestions?
> >
> >
> > Regards,
> > Jan
> >
> >
> > --
> > Jean-Baptiste Onofré
> > jbonofre@apache.org <ma...@apache.org>
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
> >
> >
> >
> >
> > --
> >
> > Apache Karaf <http://karaf.apache.org/> Committer & PMC
> > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer
> > & Project Lead
> > blog <http://notizblog.nierbeck.de/>
> >
> > Software Architect / Project Manager / Scrum Master
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
Re: Deploying a Grails WAR (non-OSGI) in Karaf
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Achim, it's what I meant by wrap (wrap == webbundle in my mind ;)).
Regards
JB
On 04/21/2014 07:01 PM, Achim Nierbeck wrote:
> Hi all,
>
> this is not true for all parts ;)
>
> If you deploy your WAR in the deploy folder Pax Web will create a OSGi
> War of it, if you want to deploy it via the shell you'll need to deploy
> it via the webbundle: url-prefix this will also wrap it to a OSGi War,
> also with this it is needed to specify the Web-ContextPath otherwise
> this installment doesn't work. This is also true if you deploy it via a
> feature.xml you'll need to add the webbundle: prefix and the
> Web-ContextPath via the URL for example:
>
> webbundle:mvn:groupID/artifactID/version/war?Web-ContextPath=myApp
>
>
> regards, Achim
>
>
>
>
> 2014-04-21 18:54 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net
> <ma...@nanthrax.net>>:
>
> Hi Jan,
>
> "pure" non OSGi war file deployment are not supported.
>
> The war has to contain at least WebApp-Context in the MANIFEST.
>
> You can use wrap on top of the war to do that, or add in your war.
>
> Regards
> JB
>
>
> On 04/21/2014 01:49 PM, Schulze, Jan wrote:
>
> Hi all,
>
> I am trying to deploy a very simple Grails webapp as a WAR
> (non-OSGI) in Karaf. It's the "Hello World" example from the
> Grails introduction at
> http://grails.org/doc/latest/__guide/gettingStarted.html#__aHelloWorldExample
> <http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExample>
>
> In the Grails testing environment it is working with both Tomcat
> and Jetty as container. When dropping the WAR into Karaf (with
> WAR-feature installed), I am getting the following exception:
>
> 2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 |
> DefaultGrailsPlugin |
> ails.plugins.__DefaultGrailsPlugin 498 | 173 - helloworld -
> 0.1.0 | Plugin [logging:2.3.7] is participating in Spring
> configuration...
> 2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 |
> DefaultGrailsPlugin |
> ails.plugins.__DefaultGrailsPlugin 498 | 173 - helloworld -
> 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring
> configuration...
> 2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 |
> HttpServiceContext |
> rnal.HttpServiceContext$__SContext 280 | 118 -
> org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | getting resource: [/]
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
> HttpServiceContext |
> rnal.HttpServiceContext$__SContext 292 | 118 -
> org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | not a URL or
> invalid URL: [/], treating as a file path
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
> WebAppWebContainerContext |
> r.war.internal.__WebAppHttpContext 113 | 166 -
> org.ops4j.pax.web.pax-web-__extender-war - 1.1.16 | Searching
> bundle [helloworld [173]] for resource [], normalized to [/]
> 2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 |
> WebAppWebContainerContext |
> r.war.internal.__WebAppHttpContext 142 | 166 -
> org.ops4j.pax.web.pax-web-__extender-war - 1.1.16 | Resource not
> found
> 2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 |
> HttpServiceContext |
> rnal.HttpServiceContext$__SContext 321 | 118 -
> org.ops4j.pax.web.pax-web-__jetty - 1.1.16 | found resource: null
> 2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace
> | ptions.__DefaultStackTraceFilterer 105
> | 173 - helloworld - 0.1.0 | Full Stack Trace:
> java.io.FileNotFoundException: ServletContext resource [/]
> cannot be resolved to URL because it does not exist
> at
> org.springframework.web.__context.support.__ServletContextResource.getURL(__ServletContextResource.java:__154)[173:helloworld:0.1]
> at org.springframework.core.io
> <http://org.springframework.core.io>.__support.__PathMatchingResourcePatternRes__olver.isJarResource(__PathMatchingResourcePatternRes__olver.java:411)[173:__helloworld:0.1]
> at org.springframework.core.io
> <http://org.springframework.core.io>.__support.__PathMatchingResourcePatternRes__olver.__findPathMatchingResources(__PathMatchingResourcePatternRes__olver.java:340)[173:__helloworld:0.1]
>
> I have been looking at the Grails configuration and the
> Jetty/Pax configuration, but I wasn't able to make any progress.
>
> The Grails webapp should automatically be available at the URL
> http://localhost:8181/__helloworld
> <http://localhost:8181/helloworld>. So I thought, that it might
> have something to do with Pax picking up the resource "/"
> instead of "helloworld".
> I tried changing the grails.app.context and the Webapp-Context
> in the WAR's MANIFEST.MF, and I also tried deploying the webapp
> as ROOT.war, but without success.
>
> Any suggestions?
>
>
> Regards,
> Jan
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
> & Project Lead
> blog <http://notizblog.nierbeck.de/>
>
> Software Architect / Project Manager / Scrum Master
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: Deploying a Grails WAR (non-OSGI) in Karaf
Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi all,
this is not true for all parts ;)
If you deploy your WAR in the deploy folder Pax Web will create a OSGi War
of it, if you want to deploy it via the shell you'll need to deploy it via
the webbundle: url-prefix this will also wrap it to a OSGi War, also with
this it is needed to specify the Web-ContextPath otherwise this installment
doesn't work. This is also true if you deploy it via a feature.xml you'll
need to add the webbundle: prefix and the Web-ContextPath via the URL for
example:
webbundle:mvn:groupID/artifactID/version/war?Web-ContextPath=myApp
regards, Achim
2014-04-21 18:54 GMT+02:00 Jean-Baptiste Onofré <jb...@nanthrax.net>:
> Hi Jan,
>
> "pure" non OSGi war file deployment are not supported.
>
> The war has to contain at least WebApp-Context in the MANIFEST.
>
> You can use wrap on top of the war to do that, or add in your war.
>
> Regards
> JB
>
>
> On 04/21/2014 01:49 PM, Schulze, Jan wrote:
>
>> Hi all,
>>
>> I am trying to deploy a very simple Grails webapp as a WAR (non-OSGI) in
>> Karaf. It's the "Hello World" example from the Grails introduction at
>> http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExample
>>
>> In the Grails testing environment it is working with both Tomcat and
>> Jetty as container. When dropping the WAR into Karaf (with WAR-feature
>> installed), I am getting the following exception:
>>
>> 2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin
>> | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld
>> - 0.1.0 | Plugin [logging:2.3.7] is participating in Spring configuration...
>> 2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin
>> | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld
>> - 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring configuration...
>> 2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 | HttpServiceContext
>> | rnal.HttpServiceContext$SContext 280 | 118 -
>> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | getting resource: [/]
>> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | HttpServiceContext
>> | rnal.HttpServiceContext$SContext 292 | 118 -
>> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | not a URL or invalid URL:
>> [/], treating as a file path
>> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 |
>> WebAppWebContainerContext | r.war.internal.WebAppHttpContext 113
>> | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Searching
>> bundle [helloworld [173]] for resource [], normalized to [/]
>> 2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 |
>> WebAppWebContainerContext | r.war.internal.WebAppHttpContext 142
>> | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Resource not
>> found
>> 2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 | HttpServiceContext
>> | rnal.HttpServiceContext$SContext 321 | 118 -
>> org.ops4j.pax.web.pax-web-jetty - 1.1.16 | found resource: null
>> 2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace
>> | ptions.DefaultStackTraceFilterer 105 | 173 - helloworld -
>> 0.1.0 | Full Stack Trace:
>> java.io.FileNotFoundException: ServletContext resource [/] cannot be
>> resolved to URL because it does not exist
>> at org.springframework.web.context.support.
>> ServletContextResource.getURL(ServletContextResource.java:
>> 154)[173:helloworld:0.1]
>> at org.springframework.core.io.support.
>> PathMatchingResourcePatternResolver.isJarResource(
>> PathMatchingResourcePatternResolver.java:411)[173:helloworld:0.1]
>> at org.springframework.core.io.support.
>> PathMatchingResourcePatternResolver.findPathMatchingResources(
>> PathMatchingResourcePatternResolver.java:340)[173:helloworld:0.1]
>>
>> I have been looking at the Grails configuration and the Jetty/Pax
>> configuration, but I wasn't able to make any progress.
>>
>> The Grails webapp should automatically be available at the URL
>> http://localhost:8181/helloworld. So I thought, that it might have
>> something to do with Pax picking up the resource "/" instead of
>> "helloworld".
>> I tried changing the grails.app.context and the Webapp-Context in the
>> WAR's MANIFEST.MF, and I also tried deploying the webapp as ROOT.war, but
>> without success.
>>
>> Any suggestions?
>>
>>
>> Regards,
>> Jan
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Software Architect / Project Manager / Scrum Master
Re: Deploying a Grails WAR (non-OSGI) in Karaf
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jan,
"pure" non OSGi war file deployment are not supported.
The war has to contain at least WebApp-Context in the MANIFEST.
You can use wrap on top of the war to do that, or add in your war.
Regards
JB
On 04/21/2014 01:49 PM, Schulze, Jan wrote:
> Hi all,
>
> I am trying to deploy a very simple Grails webapp as a WAR (non-OSGI) in Karaf. It's the "Hello World" example from the Grails introduction at http://grails.org/doc/latest/guide/gettingStarted.html#aHelloWorldExample
>
> In the Grails testing environment it is working with both Tomcat and Jetty as container. When dropping the WAR into Karaf (with WAR-feature installed), I am getting the following exception:
>
> 2014-04-20 10:44:25,875 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld - 0.1.0 | Plugin [logging:2.3.7] is participating in Spring configuration...
> 2014-04-20 10:44:25,889 | DEBUG | isherExecutor: 1 | DefaultGrailsPlugin | ails.plugins.DefaultGrailsPlugin 498 | 173 - helloworld - 0.1.0 | Plugin [i18n:2.3.7] is participating in Spring configuration...
> 2014-04-20 10:44:25,907 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 280 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | getting resource: [/]
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 292 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | not a URL or invalid URL: [/], treating as a file path
> 2014-04-20 10:44:25,908 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 113 | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Searching bundle [helloworld [173]] for resource [], normalized to [/]
> 2014-04-20 10:44:25,910 | DEBUG | isherExecutor: 1 | WebAppWebContainerContext | r.war.internal.WebAppHttpContext 142 | 166 - org.ops4j.pax.web.pax-web-extender-war - 1.1.16 | Resource not found
> 2014-04-20 10:44:25,911 | DEBUG | isherExecutor: 1 | HttpServiceContext | rnal.HttpServiceContext$SContext 321 | 118 - org.ops4j.pax.web.pax-web-jetty - 1.1.16 | found resource: null
> 2014-04-20 10:44:25,914 | ERROR | isherExecutor: 1 | StackTrace | ptions.DefaultStackTraceFilterer 105 | 173 - helloworld - 0.1.0 | Full Stack Trace:
> java.io.FileNotFoundException: ServletContext resource [/] cannot be resolved to URL because it does not exist
> at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:154)[173:helloworld:0.1]
> at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:411)[173:helloworld:0.1]
> at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:340)[173:helloworld:0.1]
>
> I have been looking at the Grails configuration and the Jetty/Pax configuration, but I wasn't able to make any progress.
>
> The Grails webapp should automatically be available at the URL http://localhost:8181/helloworld. So I thought, that it might have something to do with Pax picking up the resource "/" instead of "helloworld".
> I tried changing the grails.app.context and the Webapp-Context in the WAR's MANIFEST.MF, and I also tried deploying the webapp as ROOT.war, but without success.
>
> Any suggestions?
>
>
> Regards,
> Jan
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com