我正试图让Ebean在我的spring Kotlin项目中工作,但是当我运行我的应用程序时,我一直遇到这个异常:
Caused by: java.lang.IllegalStateException: Bean class com.sshmanager.server.database.entity.User is not enhanced?
at io.ebeaninternal.server.deploy.BeanDescriptorManager.setEntityBeanClass(BeanDescriptorManager.java:1556) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.deploy.BeanDescriptorManager.createByteCode(BeanDescriptorManager.java:1423) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1333) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:748) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:369) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:197) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:124) ~[ebean-11.22.4.jar:na]
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:35) ~[ebean-11.22.4.jar:na]
at io.ebean.EbeanServerFactory.createInternal(EbeanServerFactory.java:109) ~[ebean-11.22.4.jar:na]
at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:70) ~[ebean-11.22.4.jar:na]
at com.sshmanager.server.database.EbeanFactoryBean.getObject(EbeanFactoryBean.kt:19) ~[classes/:na]
at com.sshmanager.server.database.EbeanFactoryBean.getObject(EbeanFactoryBean.kt:10) ~[classes/:na]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
... 36 common frames omitted
我已经添加了
io.ebean.tile:enhancement
插件。
我也试过了
mvn ebean:init
[INFO] Scanning for projects...
[INFO] --- tiles-maven-plugin: Injecting 1 tiles as intermediary parent artifacts for com.sshmanager:server...
[INFO] Mixed 'com.sshmanager:server:0.0.1-SNAPSHOT' with tile 'io.ebean.tile:enhancement:5.6' as its new parent.
[INFO] Mixed 'io.ebean.tile:enhancement:5.6' with original parent 'org.springframework.boot:spring-boot-starter-parent:2.0.4.RELEASE' as its new top level parent.
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- codegen-maven-plugin:4.2:init (default-cli) @ server ---
---------------------------------------------
EBEAN : INIT - interactive ebean initialiser
---------------------------------------------
Commands:
M - Manifest - add ebean.mf to control enhancement (recommended)
P - Test properties - Add test-ebean.properties to configure Ebean when running tests (recommended)
L - Logging - Add test logging entry to log SQL when running tests (recommended)
G - Generate migrations - Add GenerateDbMigration for generating DB migration scripts (recommended)
D - Docker - Add support for running tests against Docker containers (Postgres, ElasticSearch etc)
F - Finders - generate finders
T - Type safe query beans - manually generate them (rather than via APT/KAPT)
Q - Quit
Select an command: [M/P/L/G/D/F/T/Q] > M
Select a package that will contain the entity beans
0 - Other
1 - com.sshmanager.server.database.entity
select one of the options above
1
---- answer: com.sshmanager.server.database.entity
[ERROR] Error running detection on project
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring (String.java:1931)
at io.ebean.codegen.Detection.diff (Detection.java:186)
at io.ebean.codegen.Detection.getTopPackage (Detection.java:124)
at io.ebean.codegen.InteractionHelp.questionTransactionalPackage (InteractionHelp.java:44)
at io.ebean.codegen.DoAddManifest.run (DoAddManifest.java:21)
at io.ebean.codegen.Interaction.executeManifest (Interaction.java:123)
at io.ebean.codegen.Interaction.executeCommand (Interaction.java:48)
at io.ebean.codegen.Interaction.run (Interaction.java:36)
at io.ebean.codegen.InitMojo.execute (InitMojo.java:46)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.859 s
[INFO] Finished at: 2018-09-02T15:02:21+02:00
[INFO] Final Memory: 33M/206M
[INFO] ------------------------------------------------------------------------
除了这个我找不到其他人。。。
有人知道我该怎么解决吗?
编辑
我正在使用Intellij,刚刚安装了Ebean增强插件,但仍然不起作用。。在构建消息中,我可以看到我的实体得到了增强,但我仍然有一个例外:
java.lang.IllegalStateException: Bean class com.sshmanager.server.database.entity.User is not enhanced?