-
1. Re: Problem accessing ApplicationContext in my Portlet
ndkhoiits Aug 9, 2010 5:09 AM (in response to funkybreizh)Can you attach your sample using applicationContext.xml to define beans instead of the app-portlet.xml.
I've tried and define many beans in the application context, and it works with gatein.
You should also checkout source code from http://spring-portlet-sample.googlecode.com/svn/spring-portlet-sample/trunk/ to try
-
2. Re: Problem accessing ApplicationContext in my Portlet
funkybreizh Aug 9, 2010 2:26 PM (in response to ndkhoiits)I have the same configuration :
My web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>app-portlets</display-name> <context-param> <param-name>webAppRootKey</param-name> <param-value>app-portlets</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/context/applicationContext.xml</param-value> </context-param> <filter> <filter-name>ResourceRequestFilter</filter-name> <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class> </filter> <filter-mapping> <filter-name>ResourceRequestFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.util.WebAppRootListener</listener-class> </listener> <!-- Listener that starts up the XmlWebApplicationContext IOC container (bean factory) --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Portlets servlet definitions --> <servlet> <servlet-name>ViewRendererServlet</servlet-name> <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>RegistrationServlet</servlet-name> <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class> <init-param> <param-name>portlet-class</param-name> <param-value>org.springframework.web.portlet.DispatcherPortlet</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>ViewRendererServlet</servlet-name> <url-pattern>/WEB-INF/servlet/view</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>RegistrationServlet</servlet-name> <url-pattern>registration/*</url-pattern> </servlet-mapping> </web-app>
My META-INF/context.xml
<Context path="app-portlets" crossContext="true" reloadable="true" />
My applicationContext.xml
<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="manageService" class="com.app.ManageServiceImpl" /> </beans>
My app-portlet.xml :
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <bean id="RegistrationController" class="com.app.portlets.Registration.RegistrationController"> <property name="manageService"> <ref bean="manageService" /> </property> </bean> </beans>
My error :
19:41:03,878 ERROR [DispatcherPortlet] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'RegistrationController' defined in PortletContext resource [/WEB-INF/context/app-portlet.xml]: Cannot resolve reference to bean 'manageService' while setting bean property 'manageService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'manageService' is defined
I'm using JBoss AS.
Thanks
-
3. Re: Problem accessing ApplicationContext in my Portlet
funkybreizh Aug 11, 2010 3:08 AM (in response to funkybreizh)Ok, I find...
I used to deploy my portlet not in the JBoss deploy folder, I did that thanks to the eclipse Jboss config. SO now I deploy directly in the "deploy" folder, and it works.
-
4. Re: Problem accessing ApplicationContext in my Portlet
ndkhoiits Aug 11, 2010 3:58 AM (in response to funkybreizh)You should try to deploy on apache tomcat for your problem
-
5. Re: Problem accessing ApplicationContext in my Portlet
ndkhoiits Aug 11, 2010 4:07 AM (in response to funkybreizh)If you cleared this problem, and expert at Spring portlet MVC, would you like solving the same problem in Spring community : http://forum.springsource.org/showthread.php?t=93402 , thank a lot