java.lang.NoClassDefFoundError: org/springframework/Kontext/support/ClassPathXmlApplicationContext
Bin ich mit Spring in meine Jar-Datei, um die Eigenschaften aus einer properties-Datei. Ich bin immer ausgegeben, wenn ich versuche von meinem RAD(eclipse). Aber wenn ich mich bereitstellen, meine jar-Datei im server, ich bekomme immer diese Fehlermeldung. Muss ich auf irgendeine andere XML Datei ?
Tritt der Fehler auf, wenn ich die Anwendung Kontext.
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
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:p="http://www.springframework.org/schema/p"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/util http://xml.westfieldgrp.com/public/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/beans http://xml.westfieldgrp.com/public/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://xml.westfieldgrp.com/public/schema/jee/spring-jee-3.0.xsd" >
<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:/config/devint/nimo.properties"/>
</bean>
<bean id="nimoConfigurationBean" scope="singleton"
class="com.westfieldgrp.filenet.env.NimoConfigurationBean">
<property name="serviceUser" value="${env.user}" />
<property name="servicePass" value="${env.pass}" />
</bean>
</beans>
Aufruf in Java:
public class AddEnvProperty {
public String envType(String propertyValue) {
String returnValue = "";
AddEnvProperty envProps = new AddEnvProperty();
NimoConfigurationBean nimoConfigurationBean = envProps.getConfig();
PluginLogger logger = new PluginLogger(new ResponceFilterPlugin());
logger.logDebug(this, "envType", "Getting Property Value" + propertyValue);
try {
if (propertyValue == "USER") {
returnValue = nimoConfigurationBean.getServiceUser();
} else if (propertyValue == "PASS") {
returnValue = nimoConfigurationBean.getServicePass();
}
} catch (NullPointerException ex) {
logger.logError(this, "envType", "NullPointerException:", ex);
}catch (Exception ex) {
logger.logError(this, "envType", "NullPointerException:", ex);
}
return returnValue;
}
private NimoConfigurationBean getConfig() {
ApplicationContext context =
new ClassPathXmlApplicationContext("applicationContext.xml");
NimoConfigurationBean obj = (NimoConfigurationBean) context.getBean("nimoConfigurationBean");
return obj;
}
}
Getter -, setter-Methoden in NimoConfigurationBean.java
Sie haben wahrscheinlich ein Versionskonflikt mit mehreren Versionen, die Klasse in den classpath.
Class-Path: ./lib/org.springframework.beans-3.0.1.RELEASE-A.jar ./lib/org.springframework.context-3.0.1.RELEASE-A.jar ./lib/org.springframework.core-3.0.1.RELEASE-A.jar ./lib/org.springframework.asm-3.0.1.RELEASE-A.jar ./lib/org.springframework.context.support-3.0.1.RELEASE.jar ./lib/org.springframework.expression-3.0.1.RELEASE-A.jar ./lib/src_common.jar ./xml/* ./xml/config/xml/applicationContext.xml ./xml/config/xml/environmentContext.xml ./xml/config/xml/nimo-context.xml
Ich bin mit nur Feder version 3.0.1
Class-Path: ./lib/org.springframework.beans-3.0.1.RELEASE-A.jar ./lib/org.springframework.context-3.0.1.RELEASE-A.jar ./lib/org.springframework.core-3.0.1.RELEASE-A.jar ./lib/org.springframework.asm-3.0.1.RELEASE-A.jar ./lib/org.springframework.context.support-3.0.1.RELEASE.jar ./lib/org.springframework.expression-3.0.1.RELEASE-A.jar ./lib/src_common.jar ./xml/* ./xml/config/xml/applicationContext.xml ./xml/config/xml/environmentContext.xml ./xml/config/xml/nimo-context.xml
Ich bin mit nur Feder version 3.0.1
InformationsquelleAutor user3407089 | 2014-03-11
Du musst angemeldet sein, um einen Kommentar abzugeben.
Überprüfen Sie, dass die Abhängigkeit im ur pom-Datei:
(x.x.x : geändert werden)
wenn Sie nicht mit maven :
überprüfen Sie die jar "
spring-context-x.x.x.RELEASE.jar
" in Ihren build-PfadDer code ist die Arbeit von meinem rad, aber gibt Fehler bei der Bereitstellung als JAR
Sind Sie sicher, dass die jar -
spring-context-x.x.x.RELEASE.jar
bereitgestellt wird, auch in Ihrem Glas?Ich habe es in meinem manifest.mf in "class path" Class-Path: ./lib/org.springframework.beans-3.0.1.RELEASE-A.jar ./lib/org.springframework.context-3.0.1.RELEASE-A.jar ./lib/org.springframework.core-3.0.1.RELEASE-A.jar ./lib/org.springframework.asm-3.0.1.RELEASE-A.jar ./lib/org.springframework.context.support-3.0.1.RELEASE.jar ./lib/org.springframework.expression-3.0.1.RELEASE-A.jar ./lib/src_common.jar ./xml/* ./xml/config/xml/applicationContext.xml ./xml/config/xml/environmentContext.xml ./xml/config/xml/nimo-context.xml
InformationsquelleAutor Zied.Jabnoun