I'm using CAS 3.3.1 and finally am finally getting around to trying to
link my services to my SQL Server 2005 server.
I changed this:
<bean
id="serviceRegistryDao"
class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" />
to this:
<bean id="serviceRegistryDao"
class="org.jasig.cas.services.JpaServiceRegistryDaoImpl"
p:entityManagerFactory-ref="entityManagerFactory" />
This basically just makes my serviceRegistryDao use the same
entityManagerFactory-ref as I have been successfully using to store tickets:
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
Now when I attempt to add a service, /cas/services/add.html?id= is
giving me a 500 error, and I'm getting the following error in my
tomcat6-stdout.log file:
2012-01-31 08:54:15,710 DEBUG
[org.jasig.cas.services.web.RegisteredServiceSimpleFormController] - <No
errors -> processing submit>
Hibernate: insert into RegisteredServiceImpl (allowedToProxy,
anonymousAccess, description, enabled, evaluation_order,
ignoreAttributes, name, serviceId, ssoEnabled, theme, id) values (?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?)
2012-01-31 08:54:15,773 ERROR [org.hibernate.util.JDBCExceptionReporter]
- <The value is not set for the parameter number 11.>
I see a thread from two years ago. The last suggestion was to confirm
that the id was actually an identity column, which it is:
CREATE TABLE [dbo].[RegisteredServiceImpl](
[id] [numeric](19, 0) IDENTITY(1,1) NOT NULL,
[allowedToProxy] [tinyint] NOT NULL,
[anonymousAccess] [tinyint] NOT NULL,
[description] [varchar](255) NULL,
[enabled] [tinyint] NOT NULL,
[evaluation_order] [int] NOT NULL,
[ignoreAttributes] [tinyint] NOT NULL,
[name] [varchar](255) NULL,
[serviceId] [varchar](255) NULL,
[ssoEnabled] [tinyint] NOT NULL,
[theme] [varchar](255) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
So it looks like this is an issue where the insert should look like:
insert into RegisteredServiceImpl (allowedToProxy, anonymousAccess,
description, enabled, evaluation_order, ignoreAttributes, name,
serviceId, ssoEnabled, theme) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
since Identity columns are populated automatically and will usually
error if you even attempt to specify the value of that field.
Seems like I must have the wrong Dialect set somewhere. In
cas.properties I have:
database.hibernate.dialect=org.hibernate.dialect.SQLServerDialect
In DeployerConfigContext.xml I have:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="true"/>
<property name="showSql" value="true" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean
id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
p:driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
p:url="jdbc:sqlserver://TESTDB\CASEY;databaseName=INTRANET;selectMethod=cursor;"
p:username="CasUser"
p:password="<<casuser's password>>"
/>
I'm not sure where else to look. I appreciate any suggestions.
Thanks,
Aaron
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user