Load jsp from another bundle OSGi [message #772342] |
Thu, 29 December 2011 14:52 |
Gabriel Afonso Messages: 23 Registered: December 2011 |
Junior Member |
|
|
Hi,
I have 2 WAB (Web Application Bundles), I need WAB-1 to scan the controllers of the WAB-2. Then when I deploy WAB-1 and go to the browser and I type "localhost:8080/wab-1/index" it shows me the Index page (because WAB-1 has a controller to show the index page (jsp)). When I deploy both (WAB-1 and WAB-2) the WAB-1 should scan to the controllers of the WAB-2 and be able to show his JSPs(pages). But when I type this url "localhost:8080/wab-1/SOME-PAGE-OF-WAB-2" in browser it return 404 error with this message:
HTTP Status 404 - /wab-1/WEB-INF/jsp/SOME-PAGE-OF-WAB-2.jsp
type Status report
message /wab-1/WEB-INF/jsp/SOME-PAGE-OF-WAB-2.jsp
description The requested resource (/wab-1/WEB-INF/jsp/SOME-PAGE-OF-WAB-2.jsp) is not available.
WAB-1 doesn't find a jsp file named "SOME-PAGE-OF-WAB-2" in his /wab-1/WEB-INF/jsp/ folder because there isn't this file. But it should look for this file in /wab-2/WEB-INF/jsp/ because there is this file.
I'm using Virgo with Spring DM 3.0.5. in OSGi Environment.
This is the code of WAB-1.
Manifest
Manifest-Version: 1.0
Created-By: user
Bundle-ManifestVersion: 2
Bundle-Name: WAB-1
Bundle-SymbolicName: WAB-1
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Web-ContextPath: wab-1
Webapp-Context: wab-1
Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/jstl-impl-1.2.jar
Import-Package: org.eclipse.virgo.web.dm,org.apache.taglibs.standard.tag.rt.core,com.wab2.controller
Import-Library: org.springframework.spring;version="[3.0.5.RELEASE,3.0.5.RELEASE]"
wab1-servlet.xml
<context:component-scan annotation-config="true" base-package="com.wab1.controller"></context:component-scan>
<context:component-scan annotation-config="true" base-package="com.wab2.controller"></context:component-scan>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
web.xml
<!-- CONFIGURE A PARENT APPLICATION CONTEXT -->
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- DISPATCHER SERVLET CONFIG -->
<servlet>
<servlet-name>wab1</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>wab1</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
This is the code of WAB-2.
Manifest
Manifest-Version: 1.0
Created-By: user
Bundle-ManifestVersion: 2
Bundle-Name: WAB-2
Bundle-SymbolicName: WAB-2
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Web-ContextPath: wab-2
Webapp-Context: wab-2
Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/jstl-impl-1.2.jar
Import-Package: org.eclipse.virgo.web.dm,org.apache.taglibs.standard.tag.rt.core
Import-Library: org.springframework.spring;version="[3.0.5.RELEASE,3.0.5.RELEASE]"
Export-Package: com.wab2.controller
web.xml
<!-- CONFIGURE A PARENT APPLICATION CONTEXT -->
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- DISPATCHER SERVLET CONFIG -->
<servlet>
<servlet-name>wab2</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>wab2</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Can Somebody help me??
How I can tell to WAB-1 to look for this jsp file in WAB-2 and not in WAB-1 folder?
.... sorry for my bad english
[Updated on: Thu, 29 December 2011 14:58] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05933 seconds