GlassFish - 非法状态异常
GlassFish - IllegalStateException
我正在制作一个小应用程序。目前它有几个实体 类 和一个 index.xhtml
,其中只有单词 TEST
。似乎当我尝试在服务器上 运行 它时,应用程序没有创建数据库并且 glassfish 服务器给我错误:
org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably does not work with identical applications
Expected hash: 1888662881
Current index: BeanIdentifierIndex [hash=-1322634367, indexed=12]:
0: WELD%AbstractBuiltInBean%WebProjectManager%HttpSession
1: WELD%AbstractBuiltInBean%com.ibm.jbatch.container.cdi.BatchCDIInjectionExtension%HttpSession
2: WELD%AbstractBuiltInBean%com.sun.faces.flow.FlowDiscoveryCDIExtension%HttpSession
3: WELD%AbstractBuiltInBean%org.glassfish.cdi.transaction.TransactionalExtension%HttpSession
4: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider%HttpSession
5: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScopeExtension%HttpSession
6: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionInterceptorProvider%HttpSession
7: WELD%AbstractBuiltInBean%org.glassfish.jms.injection.JMSCDIExtension%HttpSession
8: WELD%AbstractBuiltInBean%org.glassfish.osgicdi.impl.OSGiServiceExtension%HttpSession
9: WELD%AbstractBuiltInBean%org.glassfish.sse.impl.ServerSentEventCdiExtension%HttpSession
10: WELD%AbstractBuiltInBean%org.hibernate.validator.internal.cdi.ValidationExtension%HttpSession
11: WELD%AbstractBuiltInBean%root_WebProjectManager%HttpSession
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="WebProjectManager">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="javax.persistence.jdbc.user" value="alexander"/>
<property name="javax.persistence.jdbc.password" value="0898725863"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="createDDL_ddlGeneration.jdbc"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc"/>
<property name="eclipselink.ddl-generation.output-mode" value="both"/>
</properties>
</persistence-unit>
</persistence>
有什么解决办法吗?
PS: 此时我只有实体 类 所以也许这就是它不创建数据库的原因(也许它需要,例如一些 ejb 和托管 bean。请注意。)真的不知道所以这是到目前为止的整个项目:project
我认为你必须添加
transaction-type="RESOURCE_LOCAL"
或
transaction-type="JTA"
在
<persistence-unit name="WebProjectManager" transaction-type="RESOURCE_LOCAL">
那是 WELD bug。
通过在 Tomcat 或 GlassFish 中禁用会话钝化来解决此问题。
只需重启服务器:
- GlasFish 服务器
- 阿帕奇 Tomcat
无论您使用什么
在 Netbeans 上单击 -> 服务 -> 服务器 -> 右键单击(鼠标)任何服务器并重新启动
我正在制作一个小应用程序。目前它有几个实体 类 和一个 index.xhtml
,其中只有单词 TEST
。似乎当我尝试在服务器上 运行 它时,应用程序没有创建数据库并且 glassfish 服务器给我错误:
org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably does not work with identical applications
Expected hash: 1888662881
Current index: BeanIdentifierIndex [hash=-1322634367, indexed=12]:
0: WELD%AbstractBuiltInBean%WebProjectManager%HttpSession
1: WELD%AbstractBuiltInBean%com.ibm.jbatch.container.cdi.BatchCDIInjectionExtension%HttpSession
2: WELD%AbstractBuiltInBean%com.sun.faces.flow.FlowDiscoveryCDIExtension%HttpSession
3: WELD%AbstractBuiltInBean%org.glassfish.cdi.transaction.TransactionalExtension%HttpSession
4: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider%HttpSession
5: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScopeExtension%HttpSession
6: WELD%AbstractBuiltInBean%org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionInterceptorProvider%HttpSession
7: WELD%AbstractBuiltInBean%org.glassfish.jms.injection.JMSCDIExtension%HttpSession
8: WELD%AbstractBuiltInBean%org.glassfish.osgicdi.impl.OSGiServiceExtension%HttpSession
9: WELD%AbstractBuiltInBean%org.glassfish.sse.impl.ServerSentEventCdiExtension%HttpSession
10: WELD%AbstractBuiltInBean%org.hibernate.validator.internal.cdi.ValidationExtension%HttpSession
11: WELD%AbstractBuiltInBean%root_WebProjectManager%HttpSession
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="WebProjectManager">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="javax.persistence.jdbc.user" value="alexander"/>
<property name="javax.persistence.jdbc.password" value="0898725863"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="createDDL_ddlGeneration.jdbc"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc"/>
<property name="eclipselink.ddl-generation.output-mode" value="both"/>
</properties>
</persistence-unit>
</persistence>
有什么解决办法吗?
PS: 此时我只有实体 类 所以也许这就是它不创建数据库的原因(也许它需要,例如一些 ejb 和托管 bean。请注意。)真的不知道所以这是到目前为止的整个项目:project
我认为你必须添加
transaction-type="RESOURCE_LOCAL"
或
transaction-type="JTA"
在
<persistence-unit name="WebProjectManager" transaction-type="RESOURCE_LOCAL">
那是 WELD bug。
通过在 Tomcat 或 GlassFish 中禁用会话钝化来解决此问题。
只需重启服务器:
- GlasFish 服务器
- 阿帕奇 Tomcat
无论您使用什么
在 Netbeans 上单击 -> 服务 -> 服务器 -> 右键单击(鼠标)任何服务器并重新启动