我使用apache isis simpleapp-archetype创建了一个应用程序,然后将安全模块的依赖项(isis-module-security-dom和jbcrypt)添加到我的pom.xml以及我的DomainAppAppManifest的模块和服务.
在项目上运行mvn clean install后,集成测试模块中发生以下错误:
[INFO] introspecting org.apache.isis.applib.services.iactn.Interaction: class-level details
[INFO] calling @PostConstruct on all domain services
seed-users-and-roles-fixture-script : EXEC org.isisaddons.module.security.seed.SeedUsersAndRolesFixtureScript
seed-users-and-roles-fixture-script/global-tenancy : EXEC org.isisaddons.module.security.seed.scripts.GlobalTenancy
[INFO] abort transaction IsisTransaction@517e381b[state=MUST_ABORT,commands=0]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Simple App ......................................... SUCCESS [ 0.608 s]
[INFO] Simple App DOM ..................................... SUCCESS [ 14.607 s]
[INFO] Simple App Fixtures ................................ SUCCESS [ 1.285 s]
[INFO] Simple App Application ............................. SUCCESS [ 2.204 s]
[INFO] Simple App Integration Tests ....................... FAILURE [ 17.539 s]
[INFO] Simple App Webapp .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.654 s
[INFO] Finished at: 2016-09-26T18:44:48+07:00
[INFO] Final Memory: 65M/572M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.isis.tool:isis-maven-plugin:1.13.0:swagger (default) on project groupid-demo-integtests: Execution default of goal org.apache.isis.tool:isis-maven-plugin:1.13.0:swagger failed: org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "ISISSECURITY.APPLICATIONROLE" in Catalog "" Schema "ISISSECURITY". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
-> [Help 1]
原则上我遵循了security module github repository中的文档,但这根本不起作用,通过查看quickstart module,我认为需要将安全依赖项添加到父POM,并且bcrypt依赖关系需要被添加到App POM,以及对Dom POM的security-plugin依赖.
要重现错误,这就是我所做的:
使用原型创建项目
mvn archetype:generate -D archetypeGroupId=org.apache.isis.archetype -D archetypeArtifactId=simpleapp-archetype -D archetypeVersion=1.13.0 -D groupId=my.groupid -D artifactId=groupid-demo -D version=1.0-SNAPSHOT -D archetypeRepository=http://repository-estatio.forge.cloudbees.com/snapshot/ -B
然后在/groupid-demo/pom.xml中我添加了这些依赖项:
<dependency>
<groupId>org.isisaddons.module.security</groupId>
<artifactId>isis-module-security-dom</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.3m</version>
</dependency>
在/groupid-demo-app/pom.xml中我添加了这个依赖项:
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
</dependency>
在/groupid-demo-app/src/main/java/domainapp/app/DomainAppAppManifest.java我修改了模块和服务,如下所示:
@Override
public List<Class<?>> getModules() {
return Arrays.asList(
DomainAppDomainModule.class, // domain (entities and repositories)
DomainAppFixtureModule.class, // fixtures
DomainAppAppModule.class // home page service etc
,org.isisaddons.module.security.SecurityModule.class
);
}
@Override
public List<Class<?>> getAdditionalServices() {
return Arrays.asList(
org.isisaddons.module.security.dom.password.PasswordEncryptionServiceUsingJBcrypt.class
);
}
在/groupid-demo-dom/pom.xml中我添加了这个依赖项:
<dependency>
<groupId>org.isisaddons.module.security</groupId>
<artifactId>isis-module-security-dom</artifactId>
</dependency>
然后/groupid-demo-webapp/src/main/webapp/WEB-INF/shiro.ini被修改如下:
[main]
....
# to use .ini file
# securityManager.realms = $iniRealm
isisModuleSecurityRealm=org.isisaddons.module.security.shiro.IsisModuleSecurityRealm
authenticationStrategy=org.isisaddons.module.security.shiro.AuthenticationStrategyForIsisModuleSecurityRealm
securityManager.authenticator.authenticationStrategy = $authenticationStrategy
securityManager.realms = $isisModuleSecurityRealm
最后我在root pom上执行了mvn clean install并得到了上面的错误.
知道我在这里缺少什么吗?这实际上只是一个裸骨的simpleapp-archetype应用程序,应用的唯一修改是添加的安全模块.
最佳答案 是的,今天我在针对您在Apache Isis邮件列表中提出的问题汇总
this demo app时遇到了同样的问题.
问题是生成swagger规范的maven插件使用自己的AppManifest,而该清单需要正确引用安全性.
由于我不想对此进行侧面跟踪,我只是禁用了招摇目标in the pom.xml(删除’!’感叹号).
HTH
担