java - 使用 PersistenceUnitInfo 注册 ClassTransformer 时发生错误

标签 java spring jpa mifos

我正在尝试在 Eclipse 上运行服务器应用程序。我已经导入了该项目,但是当我运行它时,我收到此错误:

25  jpa-pu  WARN   [localhost-startStop-1] openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'jpa-pu', root URL [file:/C:/SourceCodeTFS/DC_MicroCreditoServer/Dev/DEV/fineract-provider/bin]. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will not be available.
36  jpa-pu  INFO   [localhost-startStop-1] openjpa.Runtime - OpenJPA dynamically loaded a validation provider.
14:42:49.579 [main] INFO  ch.vorburger.exec.ManagedProcess - Successfully destroyed Program [C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin\bin\mysqld.exe, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin, --datadir=C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\data, --port=57244] (in working directory C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin)
14:42:49.579 [main] INFO  ch.vorburger.mariadb4j.DB - Database stopped.

然后,整个应用程序崩溃了:

14:42:49.579 [main] INFO  ch.vorburger.exec.ManagedProcess - Successfully destroyed Program [C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin\bin\mysqld.exe, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin, --datadir=C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\data, --port=57244] (in working directory C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\build\db\bin)
14:42:49.579 [main] INFO  ch.vorburger.mariadb4j.DB - Database stopped.
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:124)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
    at org.apache.fineract.ServerWithMariaDB4jApplication.main(ServerWithMariaDB4jApplication.java:56)
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:100)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:74)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:295)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:147)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:148)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:121)
    ... 7 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.fineract.infrastructure.core.boot.WebXmlConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter org.apache.fineract.infrastructure.core.boot.WebXmlConfiguration.basicAuthenticationProcessingFilter; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'basicAuthenticationProcessingFilter' defined in file [C:\SourceCodeTFS\DC_MicroCreditoServer\Dev\DEV\fineract-provider\bin\org\apache\fineract\infrastructure\security\filter\TenantAwareBasicAuthenticationFilter.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.authentication.AuthenticationManager]: : Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'customAuthenticationProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProvider' defined in URL [file:/C:/SourceCodeTFS/DC_MicroCreditoServer/Dev/DEV/fineract-provider/bin/META-INF/spring/securityContext.xml]: Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.fineract.infrastructure.security.domain.PlatformUserRepository org.apache.fineract.infrastructure.security.service.TenantAwareJpaPlatformUserDetailsService.platformUserRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appUserRepository': Cannot resolve reference to bean 'jpaMapppingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMapppingContext': Invocation of init method failed; nested exception is <openjpa-2.4.1-r422266:1730418 fatal user error> org.apache.openjpa.util.MetaDataException: The type "class org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom" has not been enhanced.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'customAuthenticationProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProvider' defined in URL [file:/C:/SourceCodeTFS/DC_MicroCreditoServer/Dev/DEV/fineract-provider/bin/META-INF/spring/securityContext.xml]: Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.fineract.infrastructure.security.domain.PlatformUserRepository org.apache.fineract.infrastructure.security.service.TenantAwareJpaPlatformUserDetailsService.platformUserRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appUserRepository': Cannot resolve reference to bean 'jpaMapppingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMapppingContext': Invocation of init method failed; nested exception is <openjpa-2.4.1-r422266:1730418 fatal user error> org.apache.openjpa.util.MetaDataException: The type "class org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom" has not been enhanced.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:301)

(...)等等(...)

我花了三天时间试图理解这个错误,我已经设法看到这是关于 persistence.xml 文件、jpa 和 spring 的一些内容,但我不明白为什么会出现这个错误。你能帮我吗?

错误引用的 persistence.xml 部分:

<persistence version="2.0"
    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">

    <persistence-unit name="jpa-pu" transaction-type="RESOURCE_LOCAL">
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <properties>
        <property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
        <property name="openjpa.jdbc.DBDictionary" value="org.apache.fineract.infrastructure.core.domain.MySQLDictionaryCustom"/>
        <!--<property name="openjpa.InverseManager" value="true(Action=warn)"/> -->
      <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
       <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=CASCADE"/>
    </properties>
    </persistence-unit>
</persistence>

提前谢谢您!

最佳答案

  1. 下载并安装 Apache Activemq 5.15 并运行它。

  2. 使用命令“gradlew clean tomcatrunwar”运行 Fineract 平台

  3. 通过 Eclipse,使用以下命令连接到已经运行的 Fineract 服务器 “远程调试”

http://mail-archives.apache.org/mod_mbox/fineract-dev/201711.mbox/%3CCA+cniaRyYyMgbxpfkxTJYj_JdO61LnHrSbtkQN0JfQXqUxHZSw@mail.gmail.com%3E

关于java - 使用 PersistenceUnitInfo 注册 ClassTransformer 时发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43233210/

相关文章:

java - 这个选择排序代码有什么问题?

java - 如何在 DGS 查询中启用 @AuthenticationPrincipal 参数

spring - 在 Spring JPA 中设置表名

java - Spring 应用程序无法使用 ActiveJDBC 检测类启动

java - 为什么我的 Spring @Autowired 字段为空?

java - @Inject 和@PersistenceContext 有什么区别?

java - 检查给定端口是否在 Java 中使用 TLS 的最有效方法是什么?

java - 如何使用 livy 提交带有关键字参数的 jar?

java - 如何管理java ee事务?

java - 如何使用 JPA 进行简单的用户名搜索查询