Apache Isis 安全模块:必需 table 缺失:"ISISSECURITY.APPLICATIONROLE"

Apache Isis Security Module: Required table missing : "ISISSECURITY.APPLICATIONROLE"

我使用 apache isis simpleapp-archetype 创建了一个应用程序,然后将安全模块的依赖项(isis-module-security-domjbcrypt)添加到我的 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, but this didn't really work at all, and by taking a look at the quickstart module 中的文档我认为需要将安全依赖项添加到父 POM,并且需要将 bcrypt 依赖项添加到 App POM,并且安全-插件对 Dom POM 的依赖。

为了重现错误,这就是我所做的:

使用原型创建项目

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

最后我在根 pom 上执行了 mvn clean install 并得到了上面的错误。

知道我在这里遗漏了什么吗?这实际上只是一个简单的 simpleapp-archetype 应用程序,应用的唯一修改是添加的安全模块。

是的,我今天在汇总 this demo app 您在 Apache Isis 邮件列表中提出的问题时遇到了同样的问题。

问题是生成 swagger 规范的 maven 插件使用它自己的 AppManifest,而该清单需要正确引用安全性。

因为我不想在这方面受到牵制,所以我只是禁用了 swagger 目标 in the pom.xml(删除“!”感叹号)。

HTH 旦