How to create friendly URLs in Liferay - jsf

I am unable to shorten the URL of bookmarks present in bookmark module provided by Liferay DXP 7.0. I have tried by referring through this article, but it doesn't seem to work.
According to liferay url friendly article that i had mentioned above I did create Route.xml and also did the configuration in liferay-portlet.xml. But still bookmarks that are created in bookmark portlet their url is not changed. I am attaching the routes.xml file and liferay-portlet.xml
Routes.xml
<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 7.0.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_7_0_0.dtd">
<routes>
<route>
<pattern>/{Bookmark}</pattern>
<implicit-parameter name="p_p_id">BookmarksPortlet</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="p_p_state">normal</implicit-parameter>
<implicit-parameter name="p_p_mode">view</implicit-parameter>
<implicit-parameter name="action">view</implicit-parameter>
</route>
</routes>
Liferay-portlet.xml
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 7.0.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_7_0_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>BookmarksPortlet</portlet-name>
<icon>/resources/images/icon.png</icon>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper
</friendly-url-mapper-class>
<friendly-url-mapping>bookmarks-portlet</friendly-url-mapping>
<friendly-url-routes>META-INF/friendly-url-routes/routes.xml</friendly-url-routes>
<instanceable>true</instanceable>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<ajaxable>false</ajaxable>
<css-class-wrapper>bookmarks-portlet</css-class-wrapper>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>

Related

JSF login failing

Im new to developing with Java & JSF (this is part of Uni studies);
I'm using NetBeans 8.2, GlassFish 4.1.1 (with Derby DB), JSF 2.2:
While my login is failing authentication via a jdbcRealm which I can't figure out), its also never redirecting to my authFailure.xhtml page either & just reloads the login page.
Looking in the GlassFish logs, I simply have a message saying "
jdbcrealm.invaliduser"
My database has the following data:
--EMAIL-----------PASSWORD-----------APPGROUP
webmaster--5f4dcc3b5aa765d61d8327deb882cf99--ADMIN
staff1--5f4dcc3b5aa765d61d8327deb882cf99--USER
Ive used MD5 hashing to encrypt the word "password"
My login.xhtml page:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="NDIS Management System"/>
<meta name="author" content="Danielle Walker"/>
<title>NDIS Home</title>
<!-- Bootstrap core CSS -->
<h:outputStylesheet name="bootstrap/css/bootstrap.min.css"/>
<h:outputStylesheet name="bootstrap/css/the-big-picture.css" />
<h:outputStylesheet name="css/google-button.css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<f:verbatim>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</f:verbatim>
<f:verbatim>
<script>
var googleUser = {};
var startApp = function () {
gapi.load('auth2', function () {
// Retrieve the singleton for the GoogleAuth library and set up the client.
auth2 = gapi.auth2.init({
client_id: '.....apps.googleusercontent.com',
cookiepolicy: 'single_host_origin'
// Request scopes in addition to 'profile' and 'email'
//scope: 'additional_scope'
});
attachSignin(document.getElementById('customBtn'));
});
};
function attachSignin(element) {
console.log(element.id);
auth2.attachClickHandler(element, {},
function (googleUser) {
document.getElementById('name').text = "Signed in: " +
googleUser.getBasicProfile().getId();
//document.getElementById('login:j_username').value = googleUser.getBasicProfile().getEmail();
}, function (error) {
alert(JSON.stringify(error, undefined, 2));
//alert("Opps... an error Occured");
});
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
</f:verbatim>
<ui:insert name="head"/>
</h:head>
<h:body class="full">
<nav class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
About
</li>
<li>
Contact
</li>
</ul>
<ul class="navbar-right">
<li>
<div id="gSignInWrapper" style="padding-top:5px;">
<div id="customBtn" class="customGPlusSignIn" style="float: right;">
<span class="icon"></span><span class="buttonText">Sign In</span>
</div>
</div>
<span style="color:#f9f9f9"><div id="name"></div></span>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<h:form id="login" onsubmit="document.getElementById('login').action = 'j_security_check';" prependId="false">
<h:panelGrid columns="2">
<h:outputLabel for="j_username" value="Username" />
<h:inputText id="j_username" />
<h:outputLabel for="j_password" value="Password" />
<h:inputSecret id="j_password" />
<h:commandButton id="submit" value="Login" />
</h:panelGrid>
</h:form>
<script>startApp();</script>
<ui:insert name="body"/>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<h:outputScript name="bootstrap/js/bootstrap.min.js"/>
<script src="https://apis.google.com/js/api:client.js" />
</h:body>
</html>
My Web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>/javax.faces.resource/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<!--<welcome-file>faces/admin/mainmenu.xhtml</welcome-file>
<welcome-file>faces/user/usermenu.xhtml</welcome-file>-->
<welcome-file>/faces/index.xhtml</welcome-file>
</welcome-file-list>
<error-page>
<error-code>403</error-code>
<location>/faces/authFailure.xhtml</location>
</error-page>
<security-constraint>
<display-name>NDIS-Admin</display-name>
<web-resource-collection>
<web-resource-name>ADMIN</web-resource-name>
<description>ADMIN</description>
<url-pattern>/faces/admin/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>NDIS-User</display-name>
<web-resource-collection>
<web-resource-name>USER</web-resource-name>
<description>USER</description>
<url-pattern>/faces/user/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>USER</role-name>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jdbcRealm</realm-name>
<form-login-config>
<form-login-page>/faces/login.xhtml</form-login-page>
<form-error-page>/faces/authFailure.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>NDIS-Admin</description>
<role-name>ADMIN</role-name>
</security-role>
<security-role>
<description>NDIS-User</description>
<role-name>USER</role-name>
</security-role>
<mime-mapping>
<extension>ttf</extension>
<mime-type>css/fonts</mime-type>
</mime-mapping>
<mime-mapping>
<extension>otf</extension>
<mime-type>font/opentype</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff2</extension>
<mime-type>font/woff2</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>font/woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
My faces-config.xml file;
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<!-- This supports resources referenced from within css files e.g. url(../fonts/glyphicons) -->
<resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>
</application>
<navigation-rule>
<description>Administrator Main Menu</description>
<from-view-id>/admin/mainmenu.xhtml</from-view-id>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>logout.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>User Main Menu</description>
<from-view-id>/user/mainmenu.xhtml</from-view-id>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>logout.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
And my jdbcRealm config: (its not showing, but Digest Algorithm is set to MD5)
I solved my own issue :-)
I was missing a beans.xml & then did a clean build and it all worked.

I cannot get Mule to send an HTML formatted email

I have tried all I can think of string-to-byte-array-transformer, no string-to-byte-array-transformer, and I still get the email sent in plain/text format.
Here is my gmail version when I show original message:
Subject: Why no markup?
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Return-Path: rufus#abc.com
<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>
Please shine a light on what I am doing wrong.
Thanks, Don
Below is a simple test case:
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans"
version="EE-3.5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd">
<flow name="htmlemailtestFlow1" doc:name="htmlemailtestFlow1">
<quartz:inbound-endpoint jobName="Q1" repeatInterval="60000" responseTimeout="10000" doc:name="Quartz">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<scripting:text><![CDATA[return '<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>']]></scripting:text>
</scripting:script>
</scripting:component>
<string-to-byte-array-transformer mimeType="text/html" doc:name="String to Byte Array" />
<smtp:outbound-endpoint host="mail.abc.com" to="dharrington#abc.com" from="rufus#abc.com" subject="Why no markup?"
responseTimeout="10000" doc:name="AsnEmail" mimeType="text/html" />
</flow>
</mule>
Do you have to set the contentType on the connector:
<smtp:connector name="smtp"
validateConnections="true" contentType="text/html" />
As described in the previous comment, graphically, it is enough to make the configuration of the image if you can not apply it by code

ADF Declarative component not being processed?

So as the title says, I made a declarative component but when I add it to a web page it just displays the tag, and not the content
My tag
> <?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<af:componentDef var="attrs" componentVar="component">
<af:goImageLink id="cm" icon="/img/contextmenu.gif" destination=""
rendered="#{attrs.showPopup}">
<af:showPopupBehavior popupId="contextMenu" triggerType="click"
alignId="cm" align="endAfter"/>
</af:goImageLink>
<af:popup id="contextMenu" contentDelivery="immediate" launcherVar="source"
eventContext="self" rendered="#{attrs.showPopup}">
<af:menu binding="#{backingBeanScope.popupProcedimentos.menu}" id="m1"></af:menu>
</af:popup>
<af:popup rendered="#{attrs.showPopup}" id="p1" contentDelivery="immediate"
binding="#{backingBeanScope.popupProcedimentos.popupProcedimento}"
launcherVar="source" eventContext="self">
<af:dialog binding="#{backingBeanScope.popupProcedimentos.dialog}"
stretchChildren="first" id="d1" title="Nova janela"
contentWidth="500" contentHeight="500">
<af:inlineFrame sizing="preferred"
binding="#{backingBeanScope.popupProcedimentos.inlineFrame}"
shortDesc="Nova página" id="iframe"
source="#{backingBeanScope.listaProcessoAdministrativo.procedimentoUrl}#{attrs.DDocName}"></af:inlineFrame>
</af:dialog>
</af:popup>
<af:xmlContent>
<component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
<display-name>popupProcedimentos</display-name>
<component-extension>
<component-tag-namespace>component</component-tag-namespace>
<component-taglib-uri>/popupproceds</component-taglib-uri>
<attribute>
<attribute-name>showPopup</attribute-name>
<attribute-class>java.lang.Boolean</attribute-class>
<default-value>false</default-value>
</attribute>
<attribute>
<attribute-name>DDocName</attribute-name>
<required>true</required>
<attribute-class>java.lang.String</attribute-class>
</attribute>
</component-extension>
</component>
</af:xmlContent>
</af:componentDef>
</jsp:root>
And i just call it in the other page like this
> <popupproced:popupProcedimentos DDocName="sss" id="popup" showPopup="true" > </popupproced:popupProcedimentos>
But the rendered html page just display the tag like that, any help?
The first line of the declarative component is invalid
"> <?xml version='1.0' encoding='UTF-8'?>"
Frank
I forgot to declare the tag lib in the project of the page I was using to test it. Now everything is working fine.

JSF rendered only when value is numeric

<h:inputText rendered="#{bean.myStringVariable [is numeric]}"
id="myID"
value="#{bean.myStringVariable}"/>
Is it possible to have an expression in the rendered element that says render only if the contents myStringVariable is a numeric? I've had a look through http://developers.sun.com/docs/jscreator/help/jsp-jsfel/jsf_expression_language_intro.html but nothing jumps out.
Rgds, Kevin.
Create a custom EL function so that you can use it as follows:
<h:inputText rendered="#{util:matches(bean.myStringVariable, '\\d+')}">
First create some utility class.
package com.example.
public final class Util {
private Util() {
//
}
public static boolean matches(String value, String regex) {
return value.matches(regex);
}
}
If you're using JSP, define it as follows in /WEB-INF/util.tld:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib
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-jsptaglibrary_2_1.xsd"
version="2.1">
<display-name>Utility Functions</display-name>
<tlib-version>1.0</tlib-version>
<uri>http://example.com/util</uri>
<function>
<name>matches</name>
<function-class>com.example.Util</function-class>
<function-signature>boolean matches(java.lang.String, java.lang.String)</function-signature>
</function>
</taglib>
And declare it as follows:
<%#taglib uri="http://example.com/util" prefix="util" %>
Or if you're using Facelets, define it as follows in /META-INF/util.taglib.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>http://example.com/util</namespace>
<function>
<function-name>matches</function-name>
<function-class>com.example.Util</function-class>
<function-signature>boolean matches(java.lang.String, java.lang.String)</function-signature>
</function>
</facelet-taglib>
Add it to the web.xml as follows:
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/META-INF/util.taglib.xml</param-value>
</context-param>
(when you're on JSF 2.0, use javax.faces.FACELETS_LIBRARIES as name instead)
And declare it as follows:
<html xmlns:util="http://example.com/util">

Deploying simple Spring MVC Portlet to Liferay 5.2.3

I try to deploy a simple spring portlet in ext (I can't use Plugins SDK...) on Liferay 5.2.3
My portlet:
ext-impl/src:
package: com.ext.portlet.springmvc
HelloWorldController.java
package com.ext.portlet.springmvc;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloWorldController implements Controller {
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String aMessage = "Hello World MVC!";
ModelAndView modelAndView = new ModelAndView("hello_world");
modelAndView.addObject("message", aMessage);
return modelAndView;
}
}
ext-lib:
jstr.jar
spring-webmvc.jar
spring-webmvc-portlet.jar
spring.jar
standard.jar
ext-web/docroot/html/portlet/ext/springmvc/hello_world.jsp
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<p>This is my message: ${message}</p>
</body>
</html>
ext-web/docroot/html/portlet/ext/springmvc/index.jsp
<html>
<body>
<p>Hi</p>
</body>
</html>
ext-web/docroot/WEB-INF/springmvc-servlet.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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean name="/hello_world.html" class="com.ext.portlet.springmvc.HelloWorldController"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
ext-web/docroot/WEB-INF/portlet-ext.xml
<portlet>
<portlet-name>springmvc</portlet-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Simple JSP Portlet</title>
</portlet-info>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
ext-web/docroot/WEB-INF/web.xml
<?xml version="1.0"?>
<web-app 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" version="2.4">
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
jsp/index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
Are there some mistakes?
I get this error, when I try to deploy:
Website OC4J 10g (10.1.3) Default Web Site definiert ist. Error creating bean w
ith name 'com.liferay.portal.kernel.captcha.CaptchaUtil' defined in class path r
esource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal
.captcha.CaptchaImpl#1424b7b' of type [com.liferay.portal.captcha.CaptchaImpl] w
hile setting bean property 'captcha'; nested exception is org.springframework.be
ans.factory.BeanCreationException: Error creating bean with name 'com.liferay.po
rtal.captcha.CaptchaImpl#1424b7b' defined in class path resource [META-INF/util-
spring.xml]: Instantiation of bean failed; nested exception is org.springframewo
rk.beans.BeanInstantiationException: Could not instantiate bean class [com.lifer
ay.portal.captcha.CaptchaImpl]: Constructor threw exception; nested exception is
java.lang.NullPointerException
Hope anybody can help me...
You are using the wrong flavour of Spring mvc here. You are talking to the servlet API in your code, but you should be talking to the Portlet API. Luckily, spring has a specialized version of spring mvc, called spring portlet mvc.
To get a feel for it, read this: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/portlet.html
Checkout this blog- How to setup Liferay+SpringMVC?
You will find how to setup a Liferay+SpringMVC portlet.

Resources