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/04/15 18:50:17 UTC

Re: cannot resolve to absolute file path in karaf 3.0.0

"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>.
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