maven-assembly插件导出和名为escomled-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar
的可执行jar。但是当我尝试运行jar时,它给了我一个例外:
线程“主”中的异常org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法找到XML模式名称空间[http://www.springframework.org/schema/context]的Spring NamespaceHandler 令人反感的资源:类路径资源[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插件,但没有成功。
答案 0 :(得分:0)
这不是您的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">