-
Aug 31st, 2011, 01:02 PM
#1
Spring 3 MVC Annotation Portlet <form:form> submission NoHandlerFoundException
Hi
I am trying to run spring 3 MVC portlet on WebCenter portlet container. When i try to submit a Form (<form:form> tag), i get NoHandlerFoundException exception.I created a ActionURL with an action parameter (action=sayHello). It seems when the form (<form:form> tag) is submitted spring framework is not able to get action parameter correctly (stack trace shows it as : wlp__ns1853309770__action=sayNow).
But if i use the same actionURL in the HTML form tag, it works well.
Am i missing anything? Please see the configuration below.
Thanks for help.
-----------------------
Exception
-----------------------
javax.servlet.ServletException: org.springframework.web.portlet.NoHandlerFoundExce ption: No matching handler method found for portlet request: mode 'view', phase 'ACTION_PH
SE', parameters map['title' -> array<String>['Now u See'], 'amp;wsrp-mode' -> array<String>[''], 'amp;wsrp-extensions' -> array<String>['oracle%3Aescape-xml=true'], 'amp;wsrp-sess
onID' -> array<String>['MlhyTpxQl16q1cL2y41LVL1GPnkT7DWLV6GLph1vx7nYRHdn4 nPM!2084284607!1314812304462'], 'amp;wsrp-navigationalValues' -> array<String>[''], 'amp;wsrp-url' -> arra
<String>[''], 'amp;wsrp-requiresRewrite' -> array<String>[''], 'amp;wsrp-interactionState' -> array<String>['wlp__ns1853309770__action=sayNow'], 'amp;wsrp-navigationalState' -> ar
ay<String>['eJyLL07OL0i1zc1PSQ0GsVLU0nPykxJzbAF*5QmO'], 'amp;wsrp-secureURL' -> array<String>['false'], 'amp;wsrp-windowState' -> array<String>['']]
at oracle.portlet.client.techimpl.wsrp.WSRPBaseTermin alPipe.processException(WSRPBaseTerminalPipe.java: 40)
at oracle.portlet.client.techimpl.wsrp.WSRPBlockingIn teractionPipe.execute(WSRPBlockingInteractionPipe. java:182)
at oracle.portlet.client.techimpl.wsrp.WSRPBlockingIn teractionPipe.pre(WSRPBlockingInteractionPipe.java :48)
at oracle.portlet.client.service.pipeline.PipeContext .internalExecute2(PipeContext.java:645)
at oracle.portlet.client.service.pipeline.PipeContext .access$000(PipeContext.java:48)
at oracle.portlet.client.service.pipeline.PipeContext $1.run(PipeContext.java:493)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject .java:517)
at oracle.security.jps.internal.jaas.AccActionExecuto r.execute(AccActionExecutor.java:47)
at oracle.security.jps.internal.jaas.CascadeActionExe cutor$SubjectPrivilegedExceptionAction.run(Cascade ActionExecutor.java:79)
at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:146)
at weblogic.security.Security.runAs(Security.java:61)
at oracle.security.jps.wls.jaas.WlsActionExecutor.exe cute(WlsActionExecutor.java:48)
at oracle.security.jps.internal.jaas.CascadeActionExe cutor.execute(CascadeActionExecutor.java:52)
at oracle.security.jps.internal.jaas.AbstractSubjectS ecurity.executeAs(AbstractSubjectSecurity.java:138 )
at oracle.portlet.client.service.pipeline.PipeContext .internalExecute(PipeContext.java:497)
at oracle.portlet.client.service.pipeline.PipeContext Runnable.run(PipeContextRunnable.java:23)
aused by: oracle.portlet.server.container.OperationFailedExc eption: oracle.portlet.wsrp.v2.OperationFailedException: Internal Server Error: org.springframework.web.portlet.NoHandl
rFoundException: No matching handler method found for portlet request: mode 'view', phase 'ACTION_PHASE', parameters map['title' -> array<String>['Now u See'], 'amp;wsrp-mode' ->
rray<String>[''], 'amp;wsrp-extensions' -> array<String>['oracle%3Aescape-xml=true'], 'amp;wsrp-sessionID' -> array<String>['MlhyTpxQl16q1cL2y41LVL1GPnkT7DWLV6GLph1vx7nYRHdn4 nPM!2
84284607!1314812304462'], 'amp;wsrp-navigationalValues' -> array<String>[''], 'amp;wsrp-url' -> array<String>[''], 'amp;wsrp-requiresRewrite' -> array<String>[''], 'amp;wsrp-inter
ctionState' -> array<String>['wlp__ns1853309770__action=sayNow'], 'amp;wsrp-navigationalState' -> array<String>['eJyLL07OL0i1zc1PSQ0GsVLU0nPykxJzbAF*5QmO'], 'amp;wsrp-secureURL' -
array<String>['false'], 'amp;wsrp-windowState' -> array<String>['']].; nested exception is:
-----------------------
porlet.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
<description xml:lang="en">Spring Annotation Test Portelt</description>
<portlet-name>SpringAnnotationTest</portlet-name>
<display-name xml:lang="en">Guess Number</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPo rtlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Spring Annotation Test</title>
</portlet-info>
</portlet>
</portlet-app>
-----------------------
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
="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/schem...-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean class="org.springframework.web.portlet.mvc.annotat ion.AnnotationMethodHandlerAdapter"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlVi ew" />
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
--------------------------------
SpringAnnotationTest-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
="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
<context:component-scan base-package="com.testing.hello" />
</beans>
--------------------------------
Controller
--------------------------------
@Controller(value="helloSpring")
@RequestMapping("VIEW")
public class HelloSpring {
@RenderMapping
public String view()
{
System.out.println("showIndex is called!!!!!!!!!!!!!!!!");
return "index";
}
@ActionMapping(params = "action=sayNow" )
public void sayHello(@ModelAttribute ToDo todo,ActionRequest request,ActionResponse response) {
System.out.println("sayHello is called!!!!!!!!!!!!!!!!");
System.out.println("Check the value of ToDo="+todo.getTitle());
Map prarmMap=request.getParameterMap();
Iterator paramItr=request.getParameterMap().keySet().iterat or();
while(paramItr.hasNext())
{
String param=(String)paramItr.next();
String paramVal[]=(String[])prarmMap.get(param);
if(paramVal !=null)
{
System.out.println(" type="+paramVal.getClass());
}
System.out.println("Key="+param+" value="+paramVal[0]);
}
}
@ModelAttribute(value="todo")
public ToDo getCommandObject() {
System.out.println("getToDo is called!!!!!!!");
return new ToDo();
}
}
--------------------------------
JSP
--------------------------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<portlet:namespace var="portletNameSpace"></portlet:namespace>
<portlet:defineObjects/>
<portlet:actionURL var="sayHelloForm">
<portlet
aram name="action" value="sayNow" />
</portlet:actionURL>
<form:form id="myForm_${portletNameSpace}" htmlEscape="true" commandName="todo"
enctype="application/x-www-form-urlencoded" action="${sayHelloForm }" >
<div>
Enter form value: <form:input path="title" id="myTitle"/>
</div>
<div>
<input type="submit" value="Submit Now">
</div>
</form:form>
<form id="myForm2_${portletNameSpace }" method="post" action="${sayHelloForm}">
<div>
Enter Anything: <input type="text" name="anything" >
</div>
<div>
<input type="submit" value="Lets See Now">
</div>
</form>
-
Sep 1st, 2011, 11:05 AM
#2
Hi Guys,
I have figured out the solution for this issue. The <form:form> tag has htmlEscape true by default. This adds "amp;" to every request parameter.
Either set it to false in the <form:form tag or make it false in the web.xml
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>false</param-value>
</context-param>
-
Jul 10th, 2012, 10:17 AM
#3
PortletException while rendering the portlet in weblogic/webcenter
I am getting the following exception when this portlet is deployed into weblogic. It appears that weblogic has a default spring implementation and i may have to turn it off. Have you come across this issue.
i know this message has been posted a while ago, but want to see if you have seen this before.
Thanks much in advance,
Prasad
javax.portlet.PortletException: No adapter for handler [com.testing.hello.HelloSpring@cf3d66]: Does your handler implement a supported interface like Controller?
at org.springframework.web.portlet.DispatcherPortlet. getHandlerAdapter(DispatcherPortlet.java:971)
at org.springframework.web.portlet.DispatcherPortlet. doRenderService(DispatcherPortlet.java:810)
at org.springframework.web.portlet.FrameworkPortlet.p rocessRequest(FrameworkPortlet.java:483)
at org.springframework.web.portlet.FrameworkPortlet.d oDispatch(FrameworkPortlet.java:453)
at javax.portlet.GenericPortlet.render(GenericPortlet .java:233)
at com.bea.portlet.container.PortletStub.doRender(Por tletStub.java:1003)
at com.bea.portlet.container.FilterChainGenerator.run FilterChain(FilterChainGenerator.java:127)
at com.bea.portlet.container.PortletStub.render(Portl etStub.java:438
-
Jul 11th, 2012, 09:02 AM
#4
just in case if someone else had this issue. please see below.
it was a classloader issue with weblogic, forced managed server to use libs in web-inf/lib folder via prefer-web-inf-classes tag
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules