Temat: Spring+Hibernate+Liferay

Pojawia mi się błąd i nie wiem dlaczego:

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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
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
http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">
<aop:aspectj-autoproxy />
<context:component-scan base-package="code" />
<bean
class="org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter"
id="dataSource"> </bean>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="annotatedClasses">
<list>
<value>code.domain.News</value>
</list>
</property>
</bean>

<tx:annotation-driven transaction-manager="txManager" />

<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>


NewsController.java
package code.controller;

import java.util.HashMap;
import java.util.Map;
import java.util.List;

import javax.portlet.*;

import org.springframework.ui.Model;
import org.springframework.web.portlet.ModelAndView;
import javax.portlet.RenderResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.portlet.bind.annotation.RenderMapping;

import com.liferay.portal.PortalException;
import com.liferay.portal.kernel.exception.SystemException;

@Controller(value="newsController")
@RequestMapping(value = "VIEW")
public class NewsController {
public void handleActionRequest(ActionRequest request,
ActionResponse response) throws Exception
{
}
@RenderMapping
public ModelAndView hello(RenderRequest request, RenderResponse
response) throws Exception
{
Map<String, Object> model = new HashMap<String,
Object>();
model.put("helloWorldMessage", "Hello World");
return new ModelAndView("helloWorld", model);
}

}


Otrzymuję błąd:

2012-08-31 21:23:44 	
org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet Wiadomosci Servlet threw
exception
javax.portlet.UnavailableException: No handler found for
request


Co to oznacza?
Piotr T.

Piotr T. Spring/Microservices

Temat: Spring+Hibernate+Liferay

Nie można dopasować servletu do żądania , co masz w web.xml ?
PS:http://static.springsource.org/spring/docs/2.0.x/refer...

Temat: Spring+Hibernate+Liferay

Piotr T.:
Nie można dopasować servletu do żądania , co masz w web.xml ?
PS:http://static.springsource.org/spring/docs/2.0.x/refer...

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>ViewRendererServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ViewRendererServlet</servlet-name>
<url-pattern>/WEB-INF/servlet/view</url-pattern>
</servlet-mapping>

<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>
/WEB-INF/tld/liferay-portlet.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld</taglib-location>
</taglib>
</jsp-config>

</web-app>


Może błąd jest tutaj bo nie mam katalogu view w /WEB-INF/servlet/view

<servlet-mapping>
<servlet-name>ViewRendererServlet</servlet-name>
<url-pattern>/WEB-INF/servlet/view</url-pattern>
</servlet-mapping>

Tylko co w takim razie powinienem podać?

Generalnie portlet się buduje. Problem pojawia się przy wrzucaniu portletu na stronę. Wtedy pojawi się błąd:

2012-09-02 16:44:49,579 WARN [org.springframework.web.portlet.PageNotFound] - No mapping found for current request in DispatcherPortlet with name 'Wiadomosci', mode 'view', phase 'RENDER_PHASE', session '82A59D7324B3D3708235F656B2004631', user '10196'
2012-09-02 16:44:49,583 ERROR [org.springframework.web.portlet.DispatcherPortlet] - Could not complete request
javax.portlet.UnavailableException: No handler found for request

Wojciech Potocki edytował(a) ten post dnia 02.09.12 o godzinie 18:49

Następna dyskusja:

Spring + hibernate - proble...




Wyślij zaproszenie do