Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 找不到类org.springframework.web.context.support.ServletContextPropertyPlaceHolderConfigure_Java_Spring_Hibernate_Junit_Websphere - Fatal编程技术网

Java 找不到类org.springframework.web.context.support.ServletContextPropertyPlaceHolderConfigure

Java 找不到类org.springframework.web.context.support.ServletContextPropertyPlaceHolderConfigure,java,spring,hibernate,junit,websphere,Java,Spring,Hibernate,Junit,Websphere,我们已将Project Spring版本从3.1.2.RELEASE升级到4.3.25.RELEASE 我没有发现任何与代码相关的错误。但是Junit测试用例由于抛出以下错误而失败 找不到类 [org.springframework.web.context.support.ServletContextPropertyPlaceHolderConfigure 错误日志 Tests run: 10, Failures: 0, Errors: 10, Skipped: 0, Time elapsed:

我们已将Project Spring版本从3.1.2.RELEASE升级到4.3.25.RELEASE

我没有发现任何与代码相关的错误。但是Junit测试用例由于抛出以下错误而失败

找不到类 [org.springframework.web.context.support.ServletContextPropertyPlaceHolderConfigure

错误日志

Tests run: 10, Failures: 0, Errors: 10, Skipped: 0, Time elapsed: 3.979 sec <<< FAILURE!
testMergeInProgressStatus(com.perceptive.portal.idm.domain.AccountTest)  Time elapsed: 0.021 sec  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
    ....
    ....
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
 Error creating bean with name 'userAdminViewController': 
Unsatisfied dependency expressed through field 'userProfileService'; nested exception is 
org.springframework.beans.factory.CannotLoadBeanClassException: 
**Cannot find class [org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer]** 
for bean with name 'org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer#0' defined in class path resource [UserAdminTest-portlet.xml]; 
nested exception is java.lang.ClassNotFoundException: org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
测试运行:10次,失败:0次,错误:10次,跳过:0次,运行时间:3.979秒谢谢

我采纳了你的建议&我只做了几件事就解决了这个问题

将此代码放在UserAdminTest portlet.xml中

    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="ignoreResourceNotFound" value="false"/>
        <property name="order" value="1" />

    </bean>
为此,在pom.xml中,我将hibernate验证器版本升级为

<hibernate.validator.version>6.1.0.Final</hibernate.validator.version>
我已经放置了javaxel依赖项

<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.1-b08</version>
</dependency>

玻璃鱼
javax.el
3.0.1-b08

然后,构建成功。

ServletContextPropertyPlaceHolderConfigure
已被删除,请改用常规的
PropertyPlaceHolderConfigure
    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="ignoreResourceNotFound" value="false"/>
        <property name="order" value="1" />

    </bean>
java.lang.NoClassDefFoundError: org/hibernate/validator/spi/resourceloading/ResourceBundleLocator
<hibernate.validator.version>6.1.0.Final</hibernate.validator.version>
javax.validation.ValidationException: HV000183: 
Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, 
or use ParameterMessageInterpolator instead
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.1-b08</version>
</dependency>