[英]Resource is not found in classpath when using maven-assembly plugin
[英]maven-assembly plugin error
maven-assembly插件导出和名为escomled-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar
可执行jar。 但是当我尝试运行jar时,它给了我一个例外:
线程“主”中的异常org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法为XML模式命名空间找到Spring NamespaceHandler [ http://www.springframework.org/schema/context]令人讨厌的资源:类路径资源[appContext.xml]
我的pom.xml
文件:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version> 3.2.4.RELEASE</version>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.escomled.machinelearning.ml.Escomled_Streams_H2O_ML</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我的appContext.xml
文件:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hz="http://www.hazelcast.com/schema/spring"
xmlns:task="http://www.springframework.org/schema/task" xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
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.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd ">
<context:annotation-config />
<context:component-scan base-package="com.escomled" />
<context:component-scan base-package="com.escomled.*" />
<import resource="classpath*:config/blackBoard.xml" />
<task:annotation-driven />
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:///home/escomled/escomled_server/config/escomled.properties</value>
</list>
</property>
</bean>
<bean id="blackboard" class="com.escomled.blackboard.impl.BlackboardImpl">
<property name="hazelcastInstance" ref="hazelcastClient" />
</bean>
</beans>
注意:我尝试使用maven-shade插件,但是没有成功。
您的Maven程序集插件不是问题,而是Spring配置。 检查您的xml文件,并在乞求中查找标记中包含的名称空间。 这样的事情。 同时检查是否有所有的弹簧罐
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.