• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Getting the below error when doing formvalidation in spring

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.IllegalAccessError: tried to access method org.springframework.validation.AbstractPropertyBindingResult.getCustomEditor(Ljava/lang/String;)Ljava/beans/PropertyEditor; from class org.springframework.web.servlet.support.BindStatus
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:243)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1141)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:878)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

javax.servlet.ServletException: java.lang.IllegalAccessError: tried to access method org.springframework.validation.AbstractPropertyBindingResult.getCustomEditor(Ljava/lang/String;)Ljava/beans/PropertyEditor; from class org.springframework.web.servlet.support.BindStatus
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)


anybody having idea... please help me... thanks in advance
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please find the project files:

redirect.jsp:
-------------


<%@ page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%
response.sendRedirect("userRegistration.htm");
%>



registration.jsp:
-----------------


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form:form method="POST" commandName="user">
<table>

<tr>
<td>UserName :</td>
<td><form:input path="name" /></td>
</tr>

<tr>
<td>Password :</td>
<td><form:password path="password" />
</td>
</tr>

<tr>
<td>Gender</td>
<td><form:radiobutton path="gender" value="M" title="M" /> <form:radiobutton
path="gender" value="F" title="F" />
</td>
</tr>

<tr>
<td>Country :</td>
<td><form:select path="country">
<form:option value="0" label="India"></form:option>
<form:option value="1" label="USA"></form:option>
<form:option value="2" label="Australia"></form:option>
<form:option value="3" label="UK"></form:option>
</form:select>
</td>
</tr>

<tr>
<td>AboutYou :</td>
<td><form:textarea path="aboutYou" />
</td>
</tr>

<tr>
<td>Community :</td>
<td><form:checkbox path="community" value="Spring"
title="Spring" /> <form:checkbox path="community"
value="Hibernate" title="Hibernate" /> <form:checkbox
path="community" value="Struts" title="Struts" />
</td>
</tr>

<tr>
<td></td>
<td><form:checkbox path="mailingList"
title="Would like to join our mailingList? " /></td>
</tr>

<tr>
<td colspan="2"><input type="submit">
</td>
</tr>
</table>
</form:form>
</body>
</html>


userSuccess.jsp:
------------------

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
User Details
<hr>
User Name : ${user.name}
<br /> Gender : ${user.gender}
<br /> Country : ${user.country}
<br /> Country : ${user.country}
<br /> About You : ${user.aboutYou}
<br /> Community : ${user.community[0]} ${user.community[1]}
${user.community[2]}
<br /> Mailing List: ${user.mailingList}
</body>
</html>
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pasting some more:

dispatcher-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" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-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/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"></bean>

<bean id="userSerivce" class="com.form.validations.UserServiceImpl"></bean>

<bean name="/userRegistration.htm" class="com.form.validations.UserController"
p:userService-ref="userSerivce" p:formView="registration"
p:successView="userSuccess">
<property name="commandName" value="user"></property>
</bean>
</beans>

web.xml :
----------

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>FormValidation</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>


User.java
-----------

package com.form.validations;

public class User {

private String name;
private String password;
private String gender;
private String country;
private String aboutYou;
private String[] community;
private Boolean mailingList;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getGender() {
return gender;
}

public void setGender(String gender) {
this.gender = gender;
}

public String getCountry() {
return country;
}

public void setCountry(String country) {
this.country = country;
}

public String getAboutYou() {
return aboutYou;
}

public void setAboutYou(String aboutYou) {
this.aboutYou = aboutYou;
}

public String[] getCommunity() {
return community;
}

public void setCommunity(String[] community) {
this.community = community;
}

public Boolean getMailingList() {
return mailingList;
}

public void setMailingList(Boolean mailingList) {
this.mailingList = mailingList;
}

}


UserController.java:
----------------------

package com.form.validations;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

public class UserController extends SimpleFormController {

private UserService userService;

public UserController() {
setCommandClass(User.class);
setCommandName("user");
}

public void setUserService(UserService userService) {
this.userService = userService;
}

protected ModelAndView onSubmit(Object command) throws Exception {
User user = (User) command;
userService.add(user);
return new ModelAndView("userSuccess", "user", user);
}
}

UserService.java:
--------------------
package com.form.validations;

public interface UserService {

public void add(User user);
}


UserServiceImpl.java:
-------------------------

package com.form.validations;

public class UserServiceImpl implements UserService {

@Override
public void add(User user) {
System.out.println("User added successfully");
}
}


url : localhost:10206/FormValidation/userRegistration.htm
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please use code tags, unformatted codes are difficult to read..
How you are doing your form validation? I dont see any validator here.. and when you get this exception? when you request for it or submit the form?
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all thanks for your interest... Prasad...

I missed the validation part... whatever the code i have posted is related to register a user...

if the user is successfully registered then we will display user details ... by using modelAndview in UserController which extends SimpleFormController

while running this app. (url : localhost:10206/FormValidation/userRegistration.htm) i am getting error..

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.IllegalAccessError: tried to access method org.springframework.validation.AbstractPropertyBindingResult.getCustomEditor(Ljava/lang/String;)Ljava/beans/PropertyEditor; from class org.springframework.web.servlet.support.BindStatus
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:243)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1141)
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think, this exception has got to do with multiple versions of spring.. Can, you please post the list of all Jar files you are deploying..
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
list of jars :

/FormValidation/WebContent/WEB-INF/lib/activation.jar
/FormValidation/WebContent/WEB-INF/lib/antlr-runtime-3.0.jar
/FormValidation/WebContent/WEB-INF/lib/aopalliance-alpha1.jar
/FormValidation/WebContent/WEB-INF/lib/commons-dbcp.jar
/FormValidation/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar
/FormValidation/WebContent/WEB-INF/lib/commons-pool.jar
/FormValidation/WebContent/WEB-INF/lib/DatabaseConnectors.jar
/FormValidation/WebContent/WEB-INF/lib/log4j-1.2.16.jar
/FormValidation/WebContent/WEB-INF/lib/mail.jar
/FormValidation/WebContent/WEB-INF/lib/ojdbc5.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.asm-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.beans-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.context.support-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.context-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.core-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.expression-3.0.0.M3.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar
/FormValidation/WebContent/WEB-INF/lib/spring-2.0.6.jar
/FormValidation/WebContent/WEB-INF/lib/spring-aop.jar
/FormValidation/WebContent/WEB-INF/lib/spring-dao.jar
/FormValidation/WebContent/WEB-INF/lib/spring-web.jar
/FormValidation/WebContent/WEB-INF/lib/spring-webmvc.jar
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see a mix of different versions of spring jars, for instance spring-2.0.6.jar, spring-webmvc.jar, these jars are for spring 2.x releases.. Also, you have spring 3.x versions of jars.. Can you try putting any of the 3.x stable version jars of spring. Also, remove other version of spring jars.. like spring-2.0.6.jar,spring-web.jar .. so on..
 
srinivas urs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sure...prasad... will try with the suggested changes
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic