Apache Isis安全模块:缺少必需的表:" ISISSECURITY.APPLICATIONROLE"

时间:2016-09-26 12:09:08

标签: isis

我使用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中的文档,但这根本不起作用,通过查看quickstart module我认为需要的安全依赖性添加到父POM,并且需要将bcrypt依赖项添加到App POM,并将security-plugin依赖项添加到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应用程序,应用的唯一修改是添加的安全模块。

1 个答案:

答案 0 :(得分:2)

是的,我今天遇到了同样的问题,将this demo app放在一起解决您在Apache Isis邮件列表中提出的问题。

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

由于我不想对此进行侧面跟踪,我只是禁用了招摇目标in the pom.xml(删除了'!'感叹号)。

HTH 丹