我的 OpenLiberty-Server 在启动时抛出 StackOverflowError。 我正在使用 OpenLiberty 23.0.0.12 和 Hibernate 6.4.2.Final。
错误详细信息是:
E CWWJP0055E: An error occurred while attempting to transform the org.hibernate.jpa.internal.enhance.EnhancingClassTransformerImpl$Entry Java Class. The following failure detail was gathered:
----------
Exception thrown by transformer:
java.lang.StackOverflowError
at java.base/java.io.InputStream.<init>(InputStream.java:61)
at com.ibm.ws.artifact.zip.internal.ZipFileEntry$1.<init>(ZipFileEntry.java:199)
at com.ibm.ws.artifact.zip.internal.ZipFileEntry.getInputStream(ZipFileEntry.java:199)
at com.ibm.ws.artifact.overlay.internal.DirectoryBasedOverlayContainerImpl$OverlayDelegatingEntry.getInputStream(DirectoryBasedOverlayContainerImpl.java:488)
at com.ibm.ws.adaptable.module.internal.AdaptableEntryImpl.adapt(AdaptableEntryImpl.java:104)
at com.ibm.ws.adaptable.module.internal.InterpretedEntryImpl.adapt(InterpretedEntryImpl.java:68)
at com.ibm.ws.classloading.internal.ContainerClassLoader$EntryUniversalResource.getActualBytes(ContainerClassLoader.java:373)
at com.ibm.ws.classloading.internal.ContainerClassLoader$EntryUniversalResource.getByteResourceInformation(ContainerClassLoader.java:365)
at com.ibm.ws.classloading.internal.ContainerClassLoader$SmartClassPathImpl.getByteResourceInformation(ContainerClassLoader.java:1226)
at com.ibm.ws.classloading.internal.ContainerClassLoader.findClassBytes(ContainerClassLoader.java:1628)
at com.ibm.ws.classloading.internal.AppClassLoader.findClassBytes(AppClassLoader.java:540)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:324)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:714)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:586)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:553)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at org.hibernate.jpa.internal.enhance.EnhancingClassTransformerImpl.getEnhancer(EnhancingClassTransformerImpl.java:71)
at org.hibernate.jpa.internal.enhance.EnhancingClassTransformerImpl.transform(EnhancingClassTransformerImpl.java:49)
at com.ibm.ws.jpa.management.JPAPUnitInfo.transformClass(JPAPUnitInfo.java:1263)
at com.ibm.ws.classloading.internal.ClassLoadingServiceImpl$ClassFileTransformerAdapter.transform(ClassLoadingServiceImpl.java:390)
at com.ibm.ws.classloading.internal.AppClassLoader.doTransformation(AppClassLoader.java:382)
at com.ibm.ws.classloading.internal.AppClassLoader.transformClassBytes(AppClassLoader.java:375)
at com.ibm.ws.classloading.internal.AppClassLoader.transformClassBytes(AppClassLoader.java:360)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:331)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:714)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:586)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:553)
...
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at org.hibernate.jpa.internal.enhance.EnhancingClassTransformerImpl.getEnhancer(EnhancingClassTransformerImpl.java:71)
at org.hibernate.jpa.internal.enhance.EnhancingClassTransformerImpl.transform(EnhancingClassTransformerImpl.java:49)
at com.ibm.ws.jpa.management.JPAPUnitInfo.transformClass(JPAPUnitInfo.java:1263)
at com.ibm.ws.classloading.internal.ClassLoadingServiceImpl$ClassFileTransformerAdapter.transform(ClassLoadingServiceImpl.java:390)
at com.ibm.ws.classloading.internal.AppClassLoader.doTransformation(AppClassLoader.java:382)
at com.ibm.ws.classloading.internal.AppClassLoader.transformClassBytes(AppClassLoader.java:375)
at com.ibm.ws.classloading.internal.AppClassLoader.transformClassBytes(AppClassLoader.java:360)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:331)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:714)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:586)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:553)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
我的持久单元配置如下:
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
<persistence-unit name="MY_DB" transaction-type="JTA">
<description>MY Database</description>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/APP/APP_db_hsql</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.default_schema" value="PUBLIC" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.jdbc.batch_size" value="10000" />
<property name="hibernate.order_inserts" value="true" />
<property name="hibernate.order_updates" value="true" />
<property name="hibernate.transaction.jta.platform" value="org.hibernate.engine.transaction.jta.platform.internal.WebSphereLibertyJtaPlatform" />
<property name="hibernate.bytecode.use_reflection_optimizer" value="false"/>
</properties>
</persistence-unit>
</persistence>
类加载器的配置是:
<library
apiTypeVisibility="spec,ibm-api,api,stable,third-party" id="libs">
<fileset dir="${appl_path}/appl_libs" includes="*.jar"/>
</library>
<classloader
apiTypeVisibility="spec,ibm-api,api,stable,third-party"
commonLibraryRef="libs"
/>
libs 目录中有以下 jar:hsqldb-2.4.1.jar、dom4j-1.6.1.jar 和 jandex-3.1.6.jar。
我正在使用以下功能:
<featureManager>
<feature>localConnector-1.0</feature>
<feature>appSecurity-5.0</feature>
<feature>beanValidation-3.0</feature>
<feature>cdi-4.0</feature>
<feature>enterpriseBeansLite-4.0</feature>
<feature>mail-2.1</feature>
<feature>restfulWS-3.1</feature>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
<feature>persistenceContainer-3.1</feature>
<feature>faces-4.0</feature>
<feature>pages-3.1</feature>
<feature>localConnector-1.0</feature>
<feature>servlet-6.0</feature>
<feature>enterpriseBeansPersistentTimer-4.0</feature>
<feature>xmlBinding-4.0</feature>
<feature>xmlWS-4.0</feature>
<feature>messagingClient-3.0</feature>
<feature>ldapRegistry-3.0</feature>
<feature>transportSecurity-1.0</feature>
<feature>connectors-2.1</feature>
</featureManager>
如何解决此错误?
我尝试降级 hibernate 版本或升级 liberty 版本,但这也有同样的错误。当我在类加载器上设置 delegate="parentLast" 时,不会抛出错误,但无法启动 persistenceManager。