我正在尝试设置我的第一个 PlayORM 项目。我有一个 EAR 文件,它是 playorm 库和所有依赖项所在的位置。包含在 EAR 中,我有一个 WAR 项目。我在 WAR 中创建了一个 nosql.Persistence 类,并定义了我的实体类。我正在使用内存数据存储支持,因为这只是我的第一次测试。但是,当我尝试保留一个简单的测试实体值时,我看到了一个异常。要持久化的代码如下所示:
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(Bootstrap.AUTO_CREATE_KEY, "create");
NoSqlEntityManagerFactory factory = Bootstrap.create(
DbTypeEnum.IN_MEMORY, properties, null, null);
NoSqlEntityManager mgr = factory.createEntityManager();
EntityA entA = new EntityA();
entA.setFieldA("FieldAVal1");
entA.setFieldB("FeildBVal1");
entA.setFieldC(300);
entA.setId(UUID.randomUUID().toString());
mgr.put(entA);
mgr.flush();
我在调用 Bootstrap.create() 时得到的异常如下所示:
[0m21:47:22,922 INFO [com.alvazan.orm.logging.NoSqlRawLogger] (http-/0.0.0.0:8080-1) [rawlogger] starting NoSQL Service Provider and connecting
[0m[0m21:47:22,937 INFO [com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl] (http-/0.0.0.0:8080-1) Begin scanning for jars with nosql.Persistence.class
[0m[31m21:47:22,938 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/playpoc].[com.test.web.TestServlet]] (http-/0.0.0.0:8080-1) JBWEB000236: Servlet.service() for servlet com.test.web.TestServlet threw exception: java.lang.RuntimeException: protocol of=vfs is not supported for loading classfiles, let me know and I can fix that
at com.impetus.annovention.ClasspathDiscoverer.findResources(ClasspathDiscoverer.java:86) [playorm-1.6.jar:]
at com.impetus.annovention.Discoverer.discover(Discoverer.java:143) [playorm-1.6.jar:]
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseEntityManagerFactoryImpl.java:82) [playorm-1.6.jar:]
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.setup(BaseEntityManagerFactoryImpl.java:140) [playorm-1.6.jar:]
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstanceImpl(BootstrapImpl.java:67) [playorm-1.6.jar:]
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstance(BootstrapImpl.java:38) [playorm-1.6.jar:]
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:66) [playorm-1.6.jar:]
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:61) [playorm-1.6.jar:]
at com.test.web.TestServlet.processRequest(TestServlet.java:56) [classes:]
at com.test.web.TestServlet.doGet(TestServlet.java:40) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
我使用 PlayORM 1.6 在 JBoss EAP 6.1 上运行它。谁能解释这里发生了什么以及为什么这个简单的测试不起作用?