java.lang.NoClassDefFoundError:当我向控制器发送无效值时发生javax / el / PropertyNotFoundException [英] java.lang.NoClassDefFoundError: javax/el/PropertyNotFoundException when I send invalid values to controller

查看:101
本文介绍了java.lang.NoClassDefFoundError:当我向控制器发送无效值时发生javax / el / PropertyNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MockMvc进行控制器测试

  @Test 
public void updateEvent()throws Exception {
MockHttpServletRequestBuilder请求= MockMvcRequestBuilders
.post(/ updateEvent);
request.param(selectedEventStatusId,1);
request.param(selectedEventTypeId,1);



事件eventFromDb = createAndSaveEvent();
request.param(idEvent,eventFromDb.getId()。toString());
request.param(name,eventFromDb.getName());
request.param(description,eventFromDb.getDescription()+____); //问题的原因。如果我将写入request.param(description,eventFromDb.getDescription());它的好的工作映射如果这个字段低于
request.param(date,new SimpleDateFormat(yyyy-MM-dd).format(eventFromDb.getDate()));
request.param(eventDate,new SimpleDateFormat(yyyy-MM-dd).format(eventFromDb.getEventDate()));


ResultActions result = mockMvc.perform(request).andDo(MockMvcResultHandlers.print());

result.andExpect(MockMvcResultMatchers.view()。name(redirect:eventDetails));
result.andExpect(MockMvcResultMatchers.model()。attributeExists(idEvent));
result.andExpect(MockMvcResultMatchers.model()。attributeExists(message));


$ / code>

描述字段标记为

  @Size(min = 5)
@Pattern(regexp =[a-zA-Z] *)
private字符串描述;

我会在执行后看到下一个stackTrace:

  org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套异常是java.lang.NoClassDefFoundError:javax / el / PropertyNotFoundException 
位于org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
位于org.springframework.web.servlet。 DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at ....

模式它很好的工作,但在测试中,我看到错误,如果我没有有价值的



控制器方法:

  @RequestMapping(value =/ updateEvent,method = RequestMethod.POST)
public String updateEvent(Model model,
@Valid @ModelAttribute(livedEvent)事件事件,
BindingResult结果
@ModelAttribute(linkedCandidates)设置< Candidate> candidate,
@ModelAttribute(linkedvacancies)设置<空缺>空缺,
@RequestParam(必需= true,value =selectedEventStatusId)整数EventStatusId,
@RequestParam(required = true,value =selectedEventTypeId)Integer EventTypeId,
RedirectAttributes属性){
if(result.hasErrors()){
// model .addAttribute(idEvent,event.getId());
event.setCandidates(candidate);
event.setVacancies(空位);
返回eventDetails;
}
eventService.updateEventAndLinkedEntities(event,candidate,vacancies,EventTypeId,EventStatusId);
attributes.addAttribute(idEvent,event.getId());
属性.addAttribute(message,正确提交+ new Date());
返回redirect:eventDetails;

$ / code>

如果我替换

  request.param(description,eventFromDb.getDescription()+____); 



  request.param(description,eventFromDb.getDescription(); //这里的有效值

它是好作品



你可以帮助解决它吗?

更新



pom.xml(子模块 - 此处运行的测试)

 < project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi: schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">
< modelVersion> 4.0.0< / modelVersion> ;
< groupId> com.epam.hhs< / groupId>
< artifactId> ui< / artifactId>
< name> hhsystem ui< / name>
< ;包装> war< / packaging>
< version> 1.0.0-SNAPSHOT< / version>
<属性>
< java-version> 1.6< / java-version> ;
< org.springsecurity-version> 3.1.3.RELEASE< /org.springsecurity-version>
< org.aspectj-version> 1.6.10< /org.aspectj-version>
< org.slf4j-version> 1.6.6< /org.slf4j-version>
<! - Spring - >
< spring-framework.version> 3.2.3.RELEASE< /spring-framework.version>
< / properties>
<依赖关系>
<! - Spring - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-context< / artifactId>
< version> $ {org.springframework-version}< / version>
<排除项>
<! - 排除Commons记录SLF4j - >
<排除>
< groupId> commons-logging< / groupId>
< artifactId> commons-logging< / artifactId>
< /排除>
< /排除>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {org.springframework-version}< / version>
< /依赖关系>

< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-beans< / artifactId>
< version> $ {org.springframework-version}< / version>
< /依赖关系>

<! - Spring Security - >
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-web< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-config< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-core< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-taglibs< / artifactId>
< version> $ {org.springsecurity-version}< / version>
<排除项>
<排除>
< artifactId> spring-aop< / artifactId>
< groupId> org.springframework< / groupId>
< /排除>
< /排除>
< /依赖关系>

<! - 验证 - >
< dependency>
< groupId> javax.validation< / groupId>
< artifactId> validation-api< / artifactId>
< version> 1.1.0.Final< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-validator< / artifactId>
< version> 5.0.1.Final< / version>
< /依赖关系>

<! - Core - >
< dependency>
< groupId> com.epam.hhs< / groupId>
< artifactId>核心< / artifactId>
< version> 1.0.9-SNAPSHOT< / version>
< /依赖关系>
< dependency>
< groupId> com.epam.hhs< / groupId>
< artifactId>核心< / artifactId>
< version> 1.0.9-SNAPSHOT< / version>
< classifier>测试< / classifier>
< /依赖关系>

<! - AspectJ - >
< dependency>
< groupId> org.aspectj< / groupId>
< artifactId> aspectjrt< / artifactId>
< version> $ {org.aspectj-version}< / version>
< /依赖关系>

<! - 记录 - >
< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> slf4j-api< / artifactId>
< version> $ {org.slf4j-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> jcl-over-slf4j< / artifactId>
< version> $ {org.slf4j-version}< / version>
< scope>运行时< / scope>
< /依赖关系>
< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> slf4j-log4j12< / artifactId>
< version> $ {org.slf4j-version}< / version>
< scope>运行时< / scope>
< /依赖关系>
< dependency>
< groupId> log4j< / groupId>
< artifactId> log4j< / artifactId>
< version> 1.2.15< / version>
<排除项>
<排除>
< groupId> javax.mail< / groupId>
< artifactId>邮件< / artifactId>
< /排除>
<排除>
< groupId> javax.jms< / groupId>
< artifactId> jms< / artifactId>
< /排除>
<排除>
< groupId> com.sun.jdmk< / groupId>
< artifactId> jmxtools< / artifactId>
< /排除>
<排除>
< groupId> com.sun.jmx< / groupId>
< artifactId> jmxri< / artifactId>
< /排除>
< /排除>
< scope>运行时< / scope>
< /依赖关系>

<! - @Inject - >
< dependency>
< groupId> javax.inject< / groupId>
< artifactId> javax.inject< / artifactId>
< version> 1< / version>
< /依赖关系>

<! - Servlet - >
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet.jsp< / groupId>
< artifactId> jsp-api< / artifactId>
< version> 2.1< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> 1.2< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.el< / groupId>
< artifactId> el-api< / artifactId>
< version> 2.2< / version>
< scope>提供< / scope>
< /依赖关系>


<! - Test - >
< dependency>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.7< / version>
< scope> test< / scope>
< /依赖关系>
< dependency>
< groupId> org.mockito< / groupId>
< artifactId> mockito-all< / artifactId>
< version> 1.9.5< / version>
< /依赖关系>
<! - 模拟MVC测试 - >
<! - <依赖关系> <&的groupId GT; org.springframework< /&的groupId GT; < artifactId的>弹簧测试-MVC< / artifactId的>
< version> 1.0.0.M2< / version> <范围>试验< /范围> < /依赖性> - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-test< / artifactId>
< version> $ {spring-framework.version}< / version>
< scope> test< / scope>
< /依赖关系>
< dependency>
< groupId> org.hamcrest< / groupId>
< artifactId> hamcrest-all< / artifactId>
< version> 1.3< / version>
< scope> test< / scope>
< /依赖关系>
<! - <依赖关系> <&的groupId GT; junit的< /&的groupId GT; < artifactId的> junit的< / artifactId的>
< version> 4.10< / version> <范围>试验< /范围> <排除> <排阻> < artifactId的> hamcrest核< / artifactId的>
< groupId> org.hamcrest< / groupId> < /排除> < /排除> < /依赖性> - >
<! - <依赖关系> <&的groupId GT; com.github.springtestdbunit< /&的groupId GT; < artifactId的>弹簧体检查的DbUnit< / artifactId的>
< version> 1.0.0< / version> <范围>试验< /范围> < /依赖性> <依赖性> <&的groupId GT; org.dbunit< /&的groupId GT;
< artifactId> dbunit< / artifactId> <版本> 2.4.8< /版本> <范围>试验< /范围>
< /依赖关系> - >

< /依赖关系>

< repositories>
< repository>
< id> spring-milestone< / id>
< name> Spring Portfolio里程碑存储库< /名称>
< url> http://repo.springsource.org/milestone/< / url>
< / repository>
< / repositories>

< build>
< plugins>
< plugin>
< artifactId> maven-eclipse-plugin< / artifactId>
< version> 2.9< / version>
<配置>
< additionalProjectnatures>
< projectnature> org.springframework.ide.eclipse.core.springnature< / projectnature>
< / additionalProjectnatures>
< additionalBuildcommands>
< buildcommand> org.springframework.ide.eclipse.core.springbuilder< / buildcommand>
< / additionalBuildcommands>
< downloadSources> true< / downloadSources>
< downloadJavadocs> true< / downloadJavadocs>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 2.5.1< / version>
<配置>
< source> 1.6< / source>
< target> 1.6< / target>
< compilerArgument> -Xlint:all< / compilerArgument>
< showWarnings> true< / showWarnings>
< showDeprecation> true< / showDeprecation>
< / configuration>
< / plugin>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> exec-maven-plugin< / artifactId>
< version> 1.2.1< / version>
<配置>
< mainClass> org.test.int1.Main< / mainClass>
< / configuration>
< / plugin>
<! - < plugin> <&的groupId GT; org.apache.maven.plugins< /&的groupId GT; < artifactId的>行家-万无一失-插件< / artifactId的>
< version> 2.12< / version> <结构> < forkMode>总是小于/ forkMode> < /结构>
< / plugin> - >
< / plugins>
< / build>
< / project>

pom.xml(父模块)

 <?xml version =1.0encoding =UTF-8?> 
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">
< modelVersion> 4.0.0< / modelVersion>
< groupId> com.epam.hhs< / groupId>
< artifactId>核心< / artifactId>
< version> 1.0.9-SNAPSHOT< / version>

<名称> hhsystem核心< /名称>
<! - <包装>战争< / packaging> - >

<属性>

<! - 通用属性 - >
< java.version> 1.6< /java.version>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< project.reporting.outputEncoding> UTF-8< /project.reporting.outputEncoding>

<! - Spring - >>
< spring-framework.version> 3.2.3.RELEASE< /spring-framework.version>
< spring-data-jpa.version> 1.3.2.RELEASE< /spring-data-jpa.version>
< org.springsecurity-version> 3.1.3.RELEASE< /org.springsecurity-version>

<! - Java EE / Java SE依赖关系 - >
< jsp.version> 2.2< /jsp.version>
< jstl.version> 1.2< /jstl.version>
< servlet.version> 2.5< /servlet.version>
< jaxb-impl.version> 2.2.7< /jaxb-impl.version>

<! - Hibernate / JPA - >
< hibernate.version> 4.2.1.Final< /hibernate.version>

<! - Bean验证 - >
< hibernate-validator.version> 4.3.1.Final< /hibernate-validator.version>

<! - 数据库访问 - >
< tomcat-jdbc.version> 7.0.37< /tomcat-jdbc.version>
< ehcache.version> 2.6.6< /ehcache.version>
< hsqldb.version> 2.2.9< /hsqldb.version>

<! - AOP - >
< aspectj.version> 1.7.2< /aspectj.version>

<! - 记录 - >
< logback.version> 1.0.13< /logback.version>
< slf4j.version> 1.7.5< /slf4j.version>

<! - RSS - >
1.0
<! - Test - >
< junit.version> 4.11< /junit.version>
< hamcrest.version> 1.3< /hamcrest.version>

<! - 日期 - >
< jodatime-hibernate.version> 1.3< /jodatime-hibernate.version>
< jodatime-jsptags.version> 1.1.1< /jodatime-jsptags.version>
< jodatime.version> 2.2< /jodatime.version>
< jadira-usertype-core.version> 3.1.0.CR6< /jadira-usertype-core.version>


<! - Web依赖关系 - >
< webjars-bootstrap.version> 2.3.0< /webjars-bootstrap.version>
< webjars-jquery-ui.version> 1.9.2< /webjars-jquery-ui.version>
< webjars-jquery.version> 1.9.0< /webjars-jquery.version>
< dandelion.datatables.version> 0.8.14< /dandelion.datatables.version>

< mysql.version> 5.1.22< /mysql.version>

< / properties>

<依赖关系>
< dependency>
< groupId> log4j< / groupId>
< artifactId> log4j< / artifactId>
< version> 1.2.17< / version>
< /依赖关系>

< dependency>
< groupId> org.mule.transports< / groupId>
< artifactId> mule-transport-http< / artifactId>
< version> 3.4.0< / version>
< /依赖关系>


< dependency>
< groupId> log4j< / groupId>
< artifactId> log4j< / artifactId>
< version> 1.2.17< / version>
< /依赖关系>

< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-beans< / artifactId>
< version> 3.2.1.RELEASE< / version>
< /依赖关系>

<! - <依赖>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> $ {jstl.version}< / version>
< /依赖关系>
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> $ {servlet.version}< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet.jsp< / groupId>
< artifactId> jsp-api< / artifactId>
< version> $ {jsp.version}< / version>
< scope>提供< / scope>
< /依赖关系> - >
< dependency>
< groupId> com.sun.xml.bind< / groupId>
< artifactId> jaxb-impl< / artifactId>
< version> $ {jaxb-impl.version}< / version>
< scope>提供< / scope>
< /依赖关系>
<! - SPRING,SPRING,SPRINGITY SPRING - >
< dependency>
< groupId> org.springframework.data< / groupId>
< artifactId> spring-data-jpa< / artifactId>
< version> $ {spring-data-jpa.version}< / version>
<排除项>
<排除>
< groupId> org.springframework< / groupId>
< artifactId> *< / artifactId>
< /排除>
< /排除>
< /依赖关系>

< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-jdbc< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-aop< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-tx< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
<! - 用于EhCacheCacheManager - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-context-support< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-orm< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-oxm< / artifactId>
< version> $ {spring-framework.version}< / version>
<排除项>
<排除>
< groupId> commons-lang< / groupId>
< artifactId> commons-lang< / artifactId>
< /排除>
< /排除>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-jms< / artifactId>
< version> $ {spring-framework.version}< / version>
< /依赖关系>


<! - 数据库连接池有关commons-dbcp
与tomcat-jdbc的更多详细信息,请参阅此处:http://blog.ippon.fr/2013/ 03/13 /改进 - 春季宠物诊所 - 样本 - 申请 - 部分3/5 / - >
< dependency>
< groupId> org.apache.tomcat< / groupId>
< artifactId> tomcat-jdbc< / artifactId>
< version> $ {tomcat-jdbc.version}< / version>
< scope>运行时< / scope>
< /依赖关系>

<! - 仅适用于MySql - >
<! - <依赖关系> <&的groupId GT; MySQL的< /&的groupId GT; < artifactId的> MySQL的连接器的Java< / artifactId的>
< version> $ {mysql.version}< / version> < /依赖性> - >
< dependency>
< groupId> com.microsoft.sqlserver< / groupId>
< artifactId> sqljdbc4< / artifactId>
< version> 3.0< / version>
< /依赖关系>
<! - <依赖关系> <&的groupId GT; MySQL的< /&的groupId GT; < artifactId的> MySQL的连接器的Java< / artifactId的>
< version> $ {mysql.version}< / version> < /依赖性> - >
<! - HIBERNATE - >
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-core< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-entitymanager< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-validator< / artifactId>
< version> $ {hibernate-validator.version}< / version>
< /依赖关系>

< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-ehcache< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>

< dependency>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> 5.1.25< / version>
< /依赖关系>

<! - Webjars(作为JAR文件分发的静态依赖项) - >
< dependency>
< groupId> org.webjars< / groupId>
< artifactId>引导程序< / artifactId>
< version> $ {webjars-bootstrap.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.webjars< / groupId>
< artifactId> jquery-ui< / artifactId>
< version> $ {webjars-jquery-ui.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.webjars< / groupId>
< artifactId> jquery< / artifactId>
< version> $ {webjars-jquery.version}< / version>
< /依赖关系>

<! - Test Artifacts - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-test< / artifactId>
< version> $ {spring-framework.version}< / version>
< scope> test< / scope>
< /依赖关系>
< dependency>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> $ {junit.version}< / version>
< scope> test< / scope>
< /依赖关系>
<! - 由Spring MVC测试框架使用 - >
< dependency>
< groupId> org.hamcrest< / groupId>
< artifactId> hamcrest-library< / artifactId>
< version> $ {hamcrest.version}< / version>
< scope> test< / scope>
< /依赖关系>

< dependency>
< groupId> org.aspectj< / groupId>
< artifactId> aspectjrt< / artifactId>
< version> $ {aspectj.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.aspectj< / groupId>
< artifactId> aspectjweaver< / artifactId>
< version> $ {aspectj.version}< / version>
< scope>运行时< / scope>
< /依赖关系>

<! - Spring Security - >
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-web< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-config< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-core< / artifactId>
< version> $ {org.springsecurity-version}< / version>
< /依赖关系>
< dependency>
< groupId> org.ow2.easybeans< / groupId>
< artifactId> easybeans-uberjar-eclipselink< / artifactId>
< version> 1.2.0-M1< / version>
< /依赖关系>
< /依赖关系>

<! - 提到Maven插件版本是为了保证长期构建
的可重复性 - >
< build>
< defaultGoal>安装< / defaultGoal>
< testResources>
< testResource>
<! - 明确声明,因此Spring配置文件可以放在
旁边,它们相应的JUnit测试类(参见ValidatorTests示例) - >
< directory> $ {project.basedir} / src / test / java< / directory>
< / testResource>
< testResource>
< directory> $ {project.basedir} / src / test / resources< / directory>
< / testResource>
< / testResources>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 3.0< / version>
<配置>
< compilerArguments>
< Xlint />
< / compilerArguments>
<详细>真< /详细>
< source> $ {java.version}< / source>
< target> $ {java.version}< / target>
< showWarnings> true< / showWarnings>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-surefire-plugin< / artifactId>
<配置>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-eclipse-plugin< / artifactId>
< version> 2.9< / version>
<配置>
< downloadSources> true< / downloadSources>
< downloadJavadocs> true< / downloadJavadocs>
< wtpversion> 2.0< / wtpversion>
< sourceIncludes>
< sourceInclude> ** / *。*< / sourceInclude>
< / sourceIncludes>
< additionalBuildcommands>
< buildCommand>
< name> org.springframework.ide.eclipse.core.springbuilder< / name>
< / buildCommand>
< buildCommand>
< name> org.eclipse.m2e.core.maven2Builder< / name>
< / buildCommand>
< / additionalBuildcommands>
< additionalProjectnatures>
< projectnature> org.eclipse.jdt.core.javanature< / projectnature>
< projectnature> org.springframework.ide.eclipse.core.springnature< / projectnature>
< projectnature> org.eclipse.m2e.core.maven2Nature< / projectnature>
< / additionalProjectnatures>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-assembly-plugin< / artifactId>
< version> 2.4< / version>
<配置>
< descriptorRefs>
< descriptorRef> jar -with-dependencies< / descriptorRef>
< / descriptorRefs>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.tomcat.maven< / groupId>
< artifactId> tomcat7-maven-plugin< / artifactId>
< version> 2.0< / version>
<配置>
< server> tomcat-development-server< / server>
< port> 9966< / port>
<路径> / petclinic< /路径>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-jar-plugin< / artifactId>
< version> 2.4< / version>
<执行次数>
<执行>
<目标>
< goal> test-jar< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>
< / plugins>
< / build>

< / project>

我重启我的电脑,现在我看到其他错误(也许我改变了一些东西但是我发布了实际的dtate pom.xml)

  org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套异常是java.lang.NoSuchMethodError:javax.el.E​​xpressionFactory.newInstance()Ljavax / el / ExpressionFactory; 
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
at ...

如果我更改 2.2



上的jsp-api版本, trace:

  updateEvent(com.epam.hhsystem.web.controllers.EventMenuControllerTest)已用时间:0.398秒<<<< ;错误! 
org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套异常是java.lang.ExceptionInInitializerError
在org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet。
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
....
导致:java.lang.ExceptionInInitializerError
在org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(ResourceBundleMessageInterpolator.java:227)

....
导致:javax.el.E​​LException:Provider com.sun。 el.ExpressionFactoryImpl在javax.el.FactoryFinder.newInstance(FactoryFinder.java:97)
$ b ...
处未找到
导致:java.lang.ClassNotFoundException:com。 sun.el.E​​xpressionFactoryImpl $ b $ java.net.URLClassLoader $ 1.run(URLClassLoader.java:202)


el-impl

 < dependency> 
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet.jsp< / groupId>
< artifactId> jsp-api< / artifactId>
< version> 2.2< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> 1.2< / version>
< scope>提供< / scope>
< /依赖关系>
< dependency>
< groupId> javax.el< / groupId>
< artifactId> el-api< / artifactId>
< version> 2.2< / version>
< scope>提供< / scope>
< /依赖关系>

< dependency>
< groupId> org.glassfish.web< / groupId>
< artifactId> el-impl< / artifactId>
< version> 2.2< / version>
< /依赖关系>

它是pom.xml的工作状态



更多我删除

  servlet-api 
jsp-api
jstl
el -api

tomcat / lib



m2./repository

复制

I use MockMvc for my controller testing

@Test
    public void updateEvent() throws Exception{
        MockHttpServletRequestBuilder request = MockMvcRequestBuilders
                .post("/updateEvent");
        request.param("selectedEventStatusId", "1");
        request.param("selectedEventTypeId", "1");



        Event eventFromDb = createAndSaveEvent();
        request.param("idEvent", eventFromDb.getId().toString());
        request.param("name", eventFromDb.getName());
        request.param("description", eventFromDb.getDescription() +"____");//the reason of problem. if I will write request.param("description", eventFromDb.getDescription() );  its good work mapping if this field below
        request.param("date", new SimpleDateFormat("yyyy-MM-dd").format(eventFromDb.getDate()));
        request.param("eventDate", new SimpleDateFormat("yyyy-MM-dd").format(eventFromDb.getEventDate()));


        ResultActions result = mockMvc.perform(request).andDo(MockMvcResultHandlers.print());

        result.andExpect(MockMvcResultMatchers.view().name("redirect:eventDetails"));
        result.andExpect(MockMvcResultMatchers.model().attributeExists("idEvent"));
        result.andExpect(MockMvcResultMatchers.model().attributeExists("message"));

    }

description field mark as

    @Size(min=5)
    @Pattern(regexp="[a-zA-Z]*")    
    private String description;

I see next stackTrace after execution:

 org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/el/PropertyNotFoundException
        at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
        at ....

In production mode it good work but in test I see error if I have notValid value

controller method:

@RequestMapping(value = "/updateEvent", method = RequestMethod.POST)
    public String updateEvent(Model model,
            @Valid @ModelAttribute("existedEvent") Event event,
            BindingResult result,
            @ModelAttribute("linkedCandidates") Set<Candidate> candidates,
            @ModelAttribute("linkedvacancies") Set<Vacancy> vacancies,
            @RequestParam(required = true, value = "selectedEventStatusId")Integer EventStatusId,
            @RequestParam(required = true, value = "selectedEventTypeId")Integer EventTypeId ,
            RedirectAttributes attributes) {
        if (result.hasErrors()) {
            //model.addAttribute("idEvent", event.getId());
            event.setCandidates(candidates);
            event.setVacancies(vacancies);
            return "eventDetails";
        }
        eventService.updateEventAndLinkedEntities(event, candidates, vacancies,EventTypeId,EventStatusId);
        attributes.addAttribute("idEvent",event.getId() );
        attributes.addAttribute("message", "submitted correctly at "+new Date());
        return "redirect:eventDetails";
    }

If I replace

 request.param("description", eventFromDb.getDescription() +"____"); 

on

request.param("description", eventFromDb.getDescription();//valid value here

It is good works

Can you help to fix it?

UPDATE

pom.xml(child module - tests running here)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.epam.hhs</groupId>
    <artifactId>ui</artifactId>
    <name>hhsystem ui</name>
    <packaging>war</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>3.2.3.RELEASE</org.springframework-version>
        <org.springsecurity-version>3.1.3.RELEASE</org.springsecurity-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
        <!-- Spring -->
        <spring-framework.version>3.2.3.RELEASE</spring-framework.version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${org.springsecurity-version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring-aop</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Validation -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

        <!-- Core -->
        <dependency>
            <groupId>com.epam.hhs</groupId>
            <artifactId>core</artifactId>
            <version>1.0.9-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.epam.hhs</groupId>
            <artifactId>core</artifactId>
            <version>1.0.9-SNAPSHOT</version>
            <classifier>tests</classifier>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
         <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope> 
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>provided</scope> 
        </dependency> 
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope> 
        </dependency>


        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
        </dependency>
        <!-- Mock MVC Test -->
        <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test-mvc</artifactId> 
            <version>1.0.0.M2</version> <scope>test</scope> </dependency> -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring-framework.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> 
            <version>4.10</version> <scope>test</scope> <exclusions> <exclusion> <artifactId>hamcrest-core</artifactId> 
            <groupId>org.hamcrest</groupId> </exclusion> </exclusions> </dependency> -->
        <!-- <dependency> <groupId>com.github.springtestdbunit</groupId> <artifactId>spring-test-dbunit</artifactId> 
            <version>1.0.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.dbunit</groupId> 
            <artifactId>dbunit</artifactId> <version>2.4.8</version> <scope>test</scope> 
            </dependency> -->

    </dependencies>

    <repositories>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Portfolio Milestone Repository</name>
            <url>http://repo.springsource.org/milestone/</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
            <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> 
                <version>2.12</version> <configuration> <forkMode>always</forkMode> </configuration> 
                </plugin> -->
        </plugins>
    </build>
</project>

pom.xml(parent module)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.epam.hhs</groupId>
    <artifactId>core</artifactId>
    <version>1.0.9-SNAPSHOT</version>

    <name>hhsystem core</name>
    <!--<packaging>war</packaging> -->

    <properties>

        <!-- Generic properties -->
        <java.version>1.6</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Spring -->
        <spring-framework.version>3.2.3.RELEASE</spring-framework.version>
        <spring-data-jpa.version>1.3.2.RELEASE</spring-data-jpa.version>
        <org.springsecurity-version>3.1.3.RELEASE</org.springsecurity-version>

        <!-- Java EE / Java SE dependencies -->
        <jsp.version>2.2</jsp.version>
        <jstl.version>1.2</jstl.version>
        <servlet.version>2.5</servlet.version>
        <jaxb-impl.version>2.2.7</jaxb-impl.version>

        <!-- Hibernate / JPA -->
        <hibernate.version>4.2.1.Final</hibernate.version>

        <!-- Bean validation -->
        <hibernate-validator.version>4.3.1.Final</hibernate-validator.version>

        <!-- Database access -->
        <tomcat-jdbc.version>7.0.37</tomcat-jdbc.version>
        <ehcache.version>2.6.6</ehcache.version>
        <hsqldb.version>2.2.9</hsqldb.version>

        <!-- AOP -->
        <aspectj.version>1.7.2</aspectj.version>

        <!-- Logging -->
        <logback.version>1.0.13</logback.version>
        <slf4j.version>1.7.5</slf4j.version>

        <!-- RSS -->
        <rome.version>1.0</rome.version>

        <!-- Test -->
        <junit.version>4.11</junit.version>
        <hamcrest.version>1.3</hamcrest.version>

        <!-- Dates -->
        <jodatime-hibernate.version>1.3</jodatime-hibernate.version>
        <jodatime-jsptags.version>1.1.1</jodatime-jsptags.version>
        <jodatime.version>2.2</jodatime.version>
        <jadira-usertype-core.version>3.1.0.CR6</jadira-usertype-core.version>


        <!-- Web dependencies -->
        <webjars-bootstrap.version>2.3.0</webjars-bootstrap.version>
        <webjars-jquery-ui.version>1.9.2</webjars-jquery-ui.version>
        <webjars-jquery.version>1.9.0</webjars-jquery.version>
        <dandelion.datatables.version>0.8.14</dandelion.datatables.version>

        <mysql.version>5.1.22</mysql.version>

    </properties>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-http</artifactId>
            <version>3.4.0</version>
        </dependency>


        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.1.RELEASE</version>
        </dependency>

        <!-- <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${servlet.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>${jsp.version}</version>
            <scope>provided</scope>
        </dependency> -->
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${jaxb-impl.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- SPRING, SPRING, SPRINGITY SPRING -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${spring-data-jpa.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <!-- used for EhCacheCacheManager -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring-framework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>


        <!-- Database connection pool See here for more details on commons-dbcp 
            versus tomcat-jdbc: http://blog.ippon.fr/2013/03/13/improving-the-performance-of-the-spring-petclinic-sample-application-part-3-of-5/ -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>${tomcat-jdbc.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- For MySql only -->
        <!-- <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> 
            <version>${mysql.version}</version> </dependency> -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>3.0</version>
        </dependency>
        <!-- <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> 
            <version>${mysql.version}</version> </dependency> -->
        <!-- HIBERNATE -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.25</version>
        </dependency>

        <!-- Webjars (static dependencies distributed as JAR files) -->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>${webjars-bootstrap.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery-ui</artifactId>
            <version>${webjars-jquery-ui.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>${webjars-jquery.version}</version>
        </dependency>

        <!-- Test Artifacts -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring-framework.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- used by Spring MVC Test framework -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.easybeans</groupId>
            <artifactId>easybeans-uberjar-eclipselink</artifactId>
            <version>1.2.0-M1</version>
        </dependency>
    </dependencies>

    <!-- Maven plugin versions are mentioned in order to guarantee the build 
        reproducibility in the long term -->
    <build>
        <defaultGoal>install</defaultGoal>
        <testResources>
            <testResource>
                <!-- declared explicitly so Spring config files can be placed next to 
                    their corresponding JUnit test class (see example with ValidatorTests) -->
                <directory>${project.basedir}/src/test/java</directory>
            </testResource>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <compilerArguments>
                        <Xlint />
                    </compilerArguments>
                    <verbose>true</verbose>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                    <wtpversion>2.0</wtpversion>
                    <sourceIncludes>
                        <sourceInclude>**/*.*</sourceInclude>
                    </sourceIncludes>
                    <additionalBuildcommands>
                        <buildCommand>
                            <name>org.springframework.ide.eclipse.core.springbuilder</name>
                        </buildCommand>
                        <buildCommand>
                            <name>org.eclipse.m2e.core.maven2Builder</name>
                        </buildCommand>
                    </additionalBuildcommands>
                    <additionalProjectnatures>
                        <projectnature>org.eclipse.jdt.core.javanature</projectnature>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                        <projectnature>org.eclipse.m2e.core.maven2Nature</projectnature>
                    </additionalProjectnatures>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <server>tomcat-development-server</server>
                    <port>9966</port>
                    <path>/petclinic</path>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

I restart my pc and now I see other error(maybe i change something But I posted actual dtate of pom.xml)

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
    at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
    at ...

If I change jsp-api version on 2.2

I see next trace:

    updateEvent(com.epam.hhsystem.web.controllers.EventMenuControllerTest)  Time elapsed: 0.398 sec  <<< ERROR!
    org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
....
Caused by: java.lang.ExceptionInInitializerError
    at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(ResourceBundleMessageInterpolator.java:227)

    ....
Caused by: javax.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
    at javax.el.FactoryFinder.newInstance(FactoryFinder.java:97)

...
Caused by: java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

解决方案

I haven't el-impl in my pom.xml

 <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.el</groupId>
                <artifactId>el-api</artifactId>
                <version>2.2</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.glassfish.web</groupId>
                <artifactId>el-impl</artifactId>
                <version>2.2</version>
            </dependency>

It is working state of pom.xml

An more I delete

servlet-api
jsp-api
jstl
el-api

jar files from tomcat/lib

And copy from m2./repository.

这篇关于java.lang.NoClassDefFoundError:当我向控制器发送无效值时发生javax / el / PropertyNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆