You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by asookazian2 <as...@gmail.com> on 2014/03/25 22:08:13 UTC

cannot resolve to absolute file path in karaf 3.0.0

I'm getting the following exception during startup of karaf 3.0.0.

In my web.xml:

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>WEB-INF/config/log4j.properties</param-value>
    </context-param>

I've tried ./WEB-INF/config/log4j.properties,
WEB-INF/config/log4j.properties, and /WEB-INF/config/log4j.properties, none
of them fix this problem, please advise how to fix with or w/o exploded WAR. 
thx.

2014-03-25 13:52:58,731 | ERROR | pool-6-thread-2  | WebAppPublisher                 
| 99 - org.ops4j.pax.web.pax-web-extender-war - 3.0.5 | Error deploying web
application
java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter:
ServletContext resource [/WEB-INF/config/log4j.properties] cannot be
resolved to absolute file path - web application archive not expanded?
	at
org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:156)[271:OSGi:1.0.0.SNAPSHOT]
	at
org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:47)[271:OSGi:1.0.0.SNAPSHOT]
	at
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doStart(HttpServiceContext.java:201)[89:org.ops4j.pax.web.pax-web-jetty:3.0.5]
	at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)[79:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
	at
org.ops4j.pax.web.service.jetty.internal.JettyServerImpl$1.start(JettyServerImpl.java:187)[89:org.ops4j.pax.web.pax-web-jetty:3.0.5]
	at
org.ops4j.pax.web.service.internal.HttpServiceStarted.end(HttpServiceStarted.java:938)[88:org.ops4j.pax.web.pax-web-runtime:3.0.5]
	at
org.ops4j.pax.web.service.internal.HttpServiceProxy.end(HttpServiceProxy.java:386)[88:org.ops4j.pax.web.pax-web-runtime:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.end(RegisterWebAppVisitorWC.java:338)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:678)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.register(WebAppPublisher.java:237)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:182)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:135)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)[karaf-org.osgi.core.jar:]
	at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)[karaf-org.osgi.core.jar:]
	at
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[karaf-org.osgi.core.jar:]
	at
org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[karaf-org.osgi.core.jar:]
	at
org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)[karaf-org.osgi.core.jar:]
	at
org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[karaf-org.osgi.core.jar:]
	at
org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:101)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserver.java:213)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObserver.java:175)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.start(SimpleExtension.java:58)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender$1.run(AbstractExtender.java:266)[99:org.ops4j.pax.web.pax-web-extender-war:3.0.5]
	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_51]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_51]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_51]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_51]
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_51]
	at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]




--
View this message in context: http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: cannot resolve to absolute file path in karaf 3.0.0

Posted by Achim Nierbeck <bc...@googlemail.com>.
The Dispatcher Servlet does it automatically by using the
dispatcher-servlet.xml [1].
AFAIK Spring does reference this by re-using the servlet name tag.
Everything else is needed to run a Spring MVC application with spring-dm.
It is a working sample that is used in a Karaf Integration test, take a
look at [2].

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/dispatcher-servlet.xml
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/SpringOsgiKarafTest.java


2014-04-16 6:14 GMT+02:00 asookazian2 <as...@gmail.com>:

> We have the following config in our web.xml:
>
> <servlet>
>         <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
>
>
> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>         <init-param>
>             <param-name>contextConfigLocation</param-name>
>              <param-value>/WEB-INF/applicationContext.xml</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>
> In the below config, how do you load the applicationContext.xml?
>
>
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml
> <
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml
> >
>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>         id="WebApp_ID" version="3.0">
>
>         <display-name>HelloWorldSpring</display-name>
>         <welcome-file-list>
>                 <welcome-file>index.jsp</welcome-file>
>         </welcome-file-list>
>
>         <context-param>
>                 <param-name>contextClass</param-name>
>
>
> <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
>         </context-param>
>
>         <servlet>
>                 <servlet-name>dispatcher</servlet-name>
>
>
> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>                 <init-param>
>                         <param-name>contextClass</param-name>
>
>
> <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
>                 </init-param>
>         </servlet>
>
>         <servlet-mapping>
>                 <servlet-name>dispatcher</servlet-name>
>                 <url-pattern>*.do</url-pattern>
>         </servlet-mapping>
>
> </web-app>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032792.html
> Sent from the Karaf - User mailing list archive at Nabble.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: cannot resolve to absolute file path in karaf 3.0.0

Posted by asookazian2 <as...@gmail.com>.
We have the following config in our web.xml:

<servlet>
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
       
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
             <param-value>/WEB-INF/applicationContext.xml</param-value> 
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

In the below config, how do you load the applicationContext.xml?

https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml>  

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="WebApp_ID" version="3.0">

	<display-name>HelloWorldSpring</display-name>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

	<context-param>
		<param-name>contextClass</param-name>
	
<param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
	</context-param>

	<servlet>
		<servlet-name>dispatcher</servlet-name>
	
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextClass</param-name>
		
<param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>dispatcher</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>

</web-app>



--
View this message in context: http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032792.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: cannot resolve to absolute file path in karaf 3.0.0

Posted by Achim Nierbeck <bc...@googlemail.com>.
Just like with any other OSGi application if you want to use a package, you
need to import it, by importing I mean have the right Import-Package header
in your manifest. So going back to your use-case, make sure the WAB does
have a import-package for org.slft4j.* for example (as it is probably the
most commonly used logging mediation layer right now).
About spring-web application, yes there is a sample at the Pax Web samples
section at [1].

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/war-spring-osgi


2014-04-15 18:50 GMT+02:00 asookazian2 <as...@gmail.com>:

> "With Karaf you have all you need to use logging, just import your favorite
> logging framework package. Pax Logging will do the rest for you. "
>
> coud you please provide an example, not sure what you mean by "import your
> favorite logging frmwk".  where/how?
>
> also, is there a Spring web app Karaf example somewhere???
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032777.html
> Sent from the Karaf - User mailing list archive at Nabble.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: cannot resolve to absolute file path in karaf 3.0.0

Posted by asookazian2 <as...@gmail.com>.
"With Karaf you have all you need to use logging, just import your favorite
logging framework package. Pax Logging will do the rest for you. "

coud you please provide an example, not sure what you mean by "import your
favorite logging frmwk".  where/how?

also, is there a Spring web app Karaf example somewhere???



--
View this message in context: http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032777.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: cannot resolve to absolute file path in karaf 3.0.0

Posted by Achim Nierbeck <bc...@googlemail.com>.
it is the right path location, it's more an issue of the application.
It doesn't load the resource correctly.
But besides that since you're running with Apache Karaf
why do you try to load a logging configuration inside the war?
With Karaf you have all you need to use logging, just import your favorite
logging framework package. Pax Logging will do the rest for you.

regards, Achim


2014-03-26 21:08 GMT+01:00 asookazian2 <as...@gmail.com>:

> must the WAR be expanded or not to solve this problem?  If yes, how?  If
> no,
> what is the solution?  thx.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032419.html
> Sent from the Karaf - User mailing list archive at Nabble.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: cannot resolve to absolute file path in karaf 3.0.0

Posted by asookazian2 <as...@gmail.com>.
must the WAR be expanded or not to solve this problem?  If yes, how?  If no,
what is the solution?  thx.



--
View this message in context: http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032419.html
Sent from the Karaf - User mailing list archive at Nabble.com.