我得到的错误是:
`javax.xml.stream.FactoryConfigurationError:类的提供者 无法在创建javax.xml.stream.XMLInputFactory javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370) 在javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:154) 在 org.hibernate.service.internal.JaxbProcessor.buildStaxFactory(JaxbProcessor.java:107) 在 org.hibernate.service.internal.JaxbProcessor.staxFactory(JaxbProcessor.java:100) 在 org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:79) 在 org.hibernate.service.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:69) 在 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.mergePropertySources(EntityManagerFactoryBuilderImpl.java:549) 在 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl。(EntityManagerFactoryBuilderImpl.java:214) 在 org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:51) 在 org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:182) 在 org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:131) 在 org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:93) 在 org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:88) 在 org.hibernate.ejb.HibernatePersistence.getEntityManagerFactoryBuilderOrNull(HibernatePersistence.java:101) 在 org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:69) 在 org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54) 在 javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) 在 javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) 在 org.capgemini.test.RoutingPointTest3.setUpBeforeClass(RoutingPointTest3.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:50) 在 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 在 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 在 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) 在org.junit.runners.ParentRunner.run(ParentRunner.java:363)at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 在 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 引起:java.lang.RuntimeException:类的提供者 无法在创建javax.xml.stream.XMLInputFactory javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367) ... 35更多引起:java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory:Provider 找不到com.ctc.wstx.stax.WstxInputFactory java.util.ServiceLoader.fail(ServiceLoader.java:239)at java.util.ServiceLoader.access $ 300(ServiceLoader.java:185)at java.util.ServiceLoader $ LazyIterator.nextService(ServiceLoader.java:372) at java.util.ServiceLoader $ LazyIterator.next(ServiceLoader.java:404) 在java.util.ServiceLoader $ 1.next(ServiceLoader.java:480)at javax.xml.stream.FactoryFinder $ 1.run(FactoryFinder.java:353)at java.security.AccessController.doPrivileged(Native Method)at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341) ......还有35个
`
我试着对我的类路由点进行测试,这里是代码:
public class RoutingPointTest3 {
private static EntityManager em;
private static
EntityManagerFactory emf;
private static final String PERSISTENCE_UNIT_NAME = "sample";
@BeforeClass
public static void setUpBeforeClass() throws Exception {
emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
em = emf.createEntityManager();
}
@Test
public void test() {
EntityTransaction tx = em.getTransaction();
tx.begin();
RoutingPoint rp = new RoutingPoint();
rp.setRoutingPoint(0753);
em.persist(rp);
tx.commit();
long id = rp.getId();
assertNotNull("Id not null", id);
em.close();
RoutingPoint rp2 = em.find(RoutingPoint.class, id);
assertNotNull("routing point from database", rp2);
}
}