[cas-user] Trouble with jpa service registry on cas-management-webapp

415 views
Skip to first unread message

Sam Erie

unread,
May 30, 2018, 6:44:22 PM5/30/18
to cas-...@apereo.org
So I am running the cas-service webapp with a service registry stored in an oracle db initiated from the default json services that come with it. Specifically with the maven cas-server-overlay running in the embedded tomcat container. It runs fine on the cas-server, and has stored RegexRegisteredService table in the database as expected. 

Now I am trying to set up the cas-management-webapp, and I have given it the same pom.xml dependencies and serviceRegistry properties, but it is attempting to run different statements and failing. I am assuming I am missing some setting for the management webapp, but I am not finding anything clear in the documentation. It appears that it is trying to write too long of table names. I have found one similar problem on the message board, but the fix was editing classes to not use SAML, and this doesn't seem ideal. 

These are the properties I am setting in both cas.properties and management.properties:

#JDBC Settings

cas.jdbc.showSql=true

cas.jdbc.genDdl=true

cas.jdbc.ddlAuto=update



#Service Registry

cas.serviceRegistry.jpa.showSql=true

cas.serviceRegistry.jpa.genDdl=true

cas.serviceRegistry.jpa.ddlAuto=update


cas.serviceRegistry.watcherEnabled=true

cas.serviceRegistry.repeatInterval=120000

cas.serviceRegistry.startDelay=15000

cas.serviceRegistry.initFromJson=false

cas.serviceRegistry.jpa.failFast=true

cas.serviceRegistry.jpa.leakThreshold=10

cas.serviceRegistry.jpa.batchSize=1

cas.serviceRegistry.jpa.idleTimeout=5000

cas.serviceRegistry.jpa.pool.suspension=false

cas.serviceRegistry.jpa.pool.minSize=6

cas.serviceRegistry.jpa.pool.maxSize=18

cas.serviceRegistry.jpa.pool.maxWait=2000

cas.serviceRegistry.jpa.isolateInternalQueries=false


cas.serviceRegistry.jpa.healthQuery=SELECT 1 FROM DUAL

cas.serviceRegistry.jpa.url=jdbc:oracle:thin:@****

cas.serviceRegistry.jpa.dialect=org.hibernate.dialect.Oracle10gDialect

cas.serviceRegistry.jpa.user=casusr

cas.serviceRegistry.jpa.password=*****

cas.serviceRegistry.jpa.driverClass=oracle.jdbc.OracleDriver



And this is the first exception:

Hibernate: 

    

    alter table CASUSR.REGEXREGISTEREDSERVICE 

       add metadataCriteriaRemoveEmptyEntitiesDescriptors number(1,0)

2018-05-30 14:33:39,081 WARN [org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl] - <GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement>

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement

at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:580) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.migrateTable(AbstractSchemaMigrator.java:297) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:75) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892) [hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) [spring-orm-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) [spring-orm-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384) [spring-orm-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) [spring-orm-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) [spring-orm-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) [spring-context-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) [spring-context-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [spring-context-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.12.RELEASE.jar!/:1.5.12.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.12.RELEASE.jar!/:1.5.12.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.12.RELEASE.jar!/:1.5.12.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.12.RELEASE.jar!/:1.5.12.RELEASE]

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.12.RELEASE.jar!/:1.5.12.RELEASE]

at org.apereo.cas.mgmt.web.CasManagementWebApplication.main(CasManagementWebApplication.java:46) [cas-management-webapp-support-5.2.4.jar!/:5.2.4]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]

at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [cas-management.war:?]

at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [cas-management.war:?]

at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [cas-management.war:?]

at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) [cas-management.war:?]

Caused by: java.sql.SQLSyntaxErrorException: ORA-00972: identifier is too long


at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:45) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:933) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1718) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1678) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:332) ~[ojdbc7-12.1.0.1.0.jar!/:12.1.0.1.0]

at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-2.7.7.jar!/:?]

at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-2.7.7.jar!/:?]

at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ~[hibernate-core-5.2.13.Final.jar!/:5.2.13.Final]

... 41 more









Sam Erie

unread,
Jun 1, 2018, 8:17:51 PM6/1/18
to cas-...@apereo.org
Turns out the problem is the cas-management-webapp has saml dependencies by default, whereas cas-server-webapp does not. The saml tables are the ones that have identifiers over 30 chars, which for whatever reason oracle databases do not support. 

Easy solution if you are not using saml - just remove saml dependencies from your build. Might not be the most elegant but I added this line to the configuration section of pom.xml (right below overlay tags):
<dependentWarExcludes>WEB-INF/lib/*saml*</dependentWarExcludes>

Or if you need saml then changing the table names manually in the source code is another option. Should be in this file:

Hope this helps anyone - I was stuck on this for a while. 

Hugo Slavia

unread,
Jun 4, 2018, 9:16:49 PM6/4/18
to CAS Community
>=Oracle 12.2 supports this (Oracle 12 did not --- not sure about Oracle 12.1).

We required the SAMl so we took the Oracle upgrade path.

Sam Erie

unread,
Jun 5, 2018, 1:20:16 PM6/5/18
to cas-...@apereo.org
Good to know, thank you.

--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/56fb1d44-25b7-42b3-93a8-569d3a9b8bfb%40apereo.org.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages