我正在尝试设置我的第一个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]
我在JBoss EAP 6.1上使用PlayORM 1.6运行它。任何人都可以解释这里发生了什么以及为什么这个简单的测试不起作用?
答案 0 :(得分:2)
PlayOrm使用名为annovention的第三方库,稍作修改。这个库支持file://和jar://,因为大多数类文件都在jar和文件中,所以我们需要弄清楚如何让它适用于vfs。它应该不难修复,但我们需要实现它。我很抱歉给您带来不便。我们将在下周初尝试解决这个问题,因为Jboss是一个相当大的应用服务器。
感谢, 迪安
答案 1 :(得分:1)
支持JBoss&#39; VFS现在已添加。从主分支获取最新代码。