0
我有一個Java EE應用程序配置爲使用PicketLink作爲其安全框架。該應用程序在JBoss EAP 7(或Wildfly 10)上運行,並使用PostgreSQL 9.4作爲其後端數據存儲。我初始化PicketLink IDM框架使用PBKDF2密碼編碼就像這樣:PicketLink:'錯誤:無效字節序列編碼「UTF8」:設置密碼時爲0x00'
builder.named("MyApp").stores().jpa()
.setCredentialHandlerProperty(PasswordCredentialHandler.PASSWORD_ENCODER,
new PBKDF2PasswordEncoder("salty".getBytes(), 10000, 128))
.addContextInitializer(new PicketLinkContextInitializer(this.entityManager));
利用這種配置,但是,我定期試圖設置密碼時出現以下情況例外:
Caused by: org.picketlink.idm.IdentityManagementException: PLIDM000201: Credential update failed for account [[email protected]] and type [[email protected]].
at org.picketlink.idm.internal.ContextualIdentityManager.updateCredential(ContextualIdentityManager.java:235) [picketlink-idm-impl-2.7.0.Final.jar:]
at org.picketlink.idm.internal.ContextualIdentityManager.updateCredential(ContextualIdentityManager.java:217) [picketlink-idm-impl-2.7.0.Final.jar:]
at net.odyssi.identity.services.security.CredentialManager.changeAccountPassword(CredentialManager.java:75) [IdentityPlatform-ejb-0.1-SNAPSHOT.jar:]
... 175 more
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute statement
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692) [hibernate-entitymanager-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602) [hibernate-entitymanager-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608) [hibernate-entitymanager-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1303) [hibernate-entitymanager-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.jboss.as.jpa.container.AbstractEntityManager.flush(AbstractEntityManager.java:459) [wildfly-jpa-7.0.0.GA-redhat-2.jar:7.0.0.GA-redhat-2]
at org.picketlink.idm.jpa.internal.JPAIdentityStore.storeCredential(JPAIdentityStore.java:912) [picketlink-idm-impl-2.7.0.Final.jar:]
at org.picketlink.idm.credential.handler.AbstractCredentialHandler.update(AbstractCredentialHandler.java:225) [picketlink-idm-api-2.7.0.Final.jar:]
at org.picketlink.idm.credential.handler.AbstractCredentialHandler.update(AbstractCredentialHandler.java:51) [picketlink-idm-api-2.7.0.Final.jar:]
at org.picketlink.idm.internal.AbstractIdentityStore.updateCredential(AbstractIdentityStore.java:145) [picketlink-idm-impl-2.7.0.Final.jar:]
at org.picketlink.idm.internal.ContextualIdentityManager.updateCredential(ContextualIdentityManager.java:231) [picketlink-idm-impl-2.7.0.Final.jar:]
... 177 more
Caused by: org.hibernate.exception.DataException: could not execute statement
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2886) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3386) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:560) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:434) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1282) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1300) [hibernate-entitymanager-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
... 183 more
Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204) [hibernate-core-5.0.9.Final-redhat-1.jar:5.0.9.Final-redhat-1]
... 193 more
我說定期,因爲錯誤似乎並不是每一次都會發生。我可以設置少量的密碼(< 5),沒有任何問題。但是,如果我嘗試批量創建用戶帳戶,則每次都會發生錯誤。無論我創建多少個帳戶,我也偶爾會看到它偶爾出現。
任何想法爲什麼會發生此錯誤或我如何糾正它?
是的,我意識到這一點。我的問題更多的是關於PicketLink以及它爲什麼這樣做/我如何解決它。 – Shadowman
PicketLink是否創建了表格?如果是的話,你必須把問題與他們一起解決。 –