执行jar时出现错误javax.persistence.PersistenceException:没有名为
我用maven构建了一个罐子。运行它时,我遇到异常。如果我从eclipse主程序运行它,它工作得很好。但当我构建jar并执行它时,它抛出异常。我怎样才能使它与jar一起工作呢 以下是我的pom.xml:执行jar时出现错误javax.persistence.PersistenceException:没有名为,java,eclipse,hibernate,maven,Java,Eclipse,Hibernate,Maven,我用maven构建了一个罐子。运行它时,我遇到异常。如果我从eclipse主程序运行它,它工作得很好。但当我构建jar并执行它时,它抛出异常。我怎样才能使它与jar一起工作呢 以下是我的pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.staples</groupId>
<artifactId>CouponAllocationConsumer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>CouponAllocation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.7</jdk.version>
<spring.version>3.2.2.RELEASE</spring.version>
<spring.batch.version>2.2.0.RELEASE</spring.batch.version>
<mysql.driver.version>5.1.25</mysql.driver.version>
<junit.version>4.11</junit.version>
<maven.compiler.plugin>3.1</maven.compiler.plugin>
<maven.eclipse.plugin>2.9</maven.eclipse.plugin>
</properties>
<build>
<finalName>CouponAllocation</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>${maven.eclipse.plugin}</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- exclude junit, we need runtime dependency only -->
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/log4j.properties</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.staples.couponallocation.kafkastorm.SpoutMainTopology</mainClass>
<classpathPrefix>./dependency-jars/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.3.10.Final</version>
</dependency>
<!-- Json and GSon jar -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.4</version>
</dependency>
<!-- Spring XML to/back object -->
<!-- dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId>
<version>${spring.version}</version> </dependency -->
<!-- MySQL database driver -->
<!-- dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId>
<version>${mysql.driver.version}</version> </dependency -->
<!-- Spring Batch dependencies -->
<!-- Spring Batch unit test -->
<!-- Storm kafka jar -->
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-kafka</artifactId>
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.9.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.1</artifactId>
<version>0.8.2.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<!-- LOG4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
4.0.0
史泰博
耦合位置消费者
0.0.1-快照
罐子
耦合定位
http://maven.apache.org
UTF-8
1.7
3.2.2.1发布
2.2.0.1发布
5.1.25
4.11
3.1
2.9
耦合定位
org.apache.maven.plugins
maven eclipse插件
${maven.eclipse.plugin}
真的
假的
org.apache.maven.plugins
maven编译器插件
${maven.compiler.plugin}
${jdk.version}
${jdk.version}
org.apache.maven.plugins
maven依赖插件
2.5.1
复制依赖项
包裹
复制依赖项
运行时
${project.build.directory}/dependency jars/
org.apache.maven.plugins
maven jar插件
**/log4j.properties
真的
com.staples.couponallocation.kafkastrm.sputtmaintopology
酒瓶/
org.apache.maven.plugins
maven汇编插件
2.2-β-4
带有依赖项的jar
包裹
单一的
org.hibernate
休眠验证器
4.3.0.1最终版本
org.hibernate
冬眠核心
4.3.10.最终版本
org.hibernate
hibernate-c3p0
4.3.10.最终版本
org.json
json
20140107
com.google.code.gson
格森
2.4
org.apache.storm
卡夫卡风暴
0.9.3
org.apache.kafka
卡夫卡客户
0.9.0.0
org.apache.kafka
卡夫卡2.9.1
0.8.2.2
org.slf4j
slf4j-log4j12
log4j
log4j
org.apache.zookeeper
动物园管理员
org.apache.storm
风暴核心
0.9.3
org.apache.zookeeper
动物园管理员
假如
org.springframework
春天
2.5.5
org.springframework
弹簧芯
4.2.3.1发布
朱尼特
朱尼特
${junit.version}
测试
com.oracle
ojdbc14
10.2.0.4.0
org.hibernate
休眠实体管理器
4.3.10.最终版本
org.hibernate
休眠注释
3.5.6-最终版本
org.eclipse.persistence
javax.persistence
2.0.0
org.eclipse.persistence
日食
2.5.0
javax.transaction
jta
1.1
log4j
log4j
1.2.17
org.apache.zookeeper
动物园管理员
3.4.6
org.slf4j
slf4j-log4j12
如果可以,请也添加异常日志。我收到了这个异常。java.lang.RuntimeException:javax.persistence.PersistenceException:EntityManager在backtype.storm.utils.DisruptorQueue.ConsumerBatchToCursor(DisruptorQueue.java:128)中没有名为RewardsRaltime的持久化提供程序在backtype.storm.utils.DisruptorQueue.ConsumerBatchWhenAvailable(DisruptorQueue.java:99)在backtype.storm.disruptor$consumer\u batch\u when\u可用时调用(disruptor.clj:80)在backtype.storm.daemon.executor$fn\uu 3441$fn\uuu 3453$fn\uu 3500.invoke(executor.clj:748)在backtype.storm.util$async\u loop$fn\u464.invoke(clj:463)在clojure.AFn.run(AFn.java:24如果可以的话,请也添加异常日志。我得到了这个异常。java.lang.RuntimeException:javax.persistence.PersistenceException:EntityManager在backtype.storm.utils.DisruptorQueue.ConsumerBatchToCursor(DisruptorQueue.java:128)没有名为RewardsRaltime的持久化提供程序)在backtype.storm.utils.DisruptorQueue.ConsumerBatchWhenAvailable(DisruptorQueue.java:99)在backtype.storm.disruptor$consumer\u batch\u when\u可用时调用(disruptor.clj:80)在backtype.storm.daemon.executor$fn\uu 3441$fn\uuu 3453$fn\uu 3500.invoke(executor.clj:748)在backtype.storm.util$async\u loop$fn\u464.invoke(clj:463)在clojure.AFn.run(AFn.java:24)