Назад | Перейти на главную страницу

jayspt EncryptionInitializationException Для гибернации не зарегистрирован строковый шифровальщик

У меня появляется следующее сообщение об ошибке: «Для спящего режима не зарегистрирован строковый шифровальщик с именем myHibernateStringEncryptor»

Но это кажется определенным? Где моя проблема? Кажется, определил "myHibernateStringEncryptor" в application-context-spring.xml с помощью persistence.xml ?? Спасибо

1 журнал

    2019-11-19 16:51:04.115 - ASYNC - ERROR      : Error batch l'exécution du batch 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEmf' defined in class path resource [config/test/application-context-spring.xml]: 
Invocation of init method failed; nested exception is org.jasypt.exceptions.EncryptionInitializationException: 
No string encryptor registered for hibernate with name "myHibernateStringEncryptor"

2 application-context-spring.xml

<bean id="stringEncryptor"
    class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
    <property name="algorithm">
        <value>PBEWithMD5AndDES</value>
    </property>
    <property name="password">
        <value>ZZZZZ</value>
    </property>
  </bean>

  <bean id="hibernateEncryptor"
    class="org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor">
    <property name="registeredName">
        <value>myHibernateStringEncryptor</value>
    </property>
    <property name="encryptor">
        <ref bean="stringEncryptor" />
    </property>
  </bean>

<!-- application-context-spring call persistence.xml -->
  <bean id="persistenceUnitManager"
              class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
        <property name="persistenceXmlLocations">
            <list>
                <value>classpath:META-INF/persistence.xml</value>
            </list>
        </property>
    </bean>

3 persistence.xml

<persistence-unit name="myPersistenceUnit"
    transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <properties>
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.connection.url" value="${ENV-DATABASE-URL}" />
        <property name="hibernate.connection.username" value="${ENV-DATABASE-USERNAME}" />
        <!-- Only uncomment for test purpose , to re create the schema -->
                    <property name="hibernate.hbm2ddl.auto" value="validate" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
        <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
        <property name="hibernate.connection.provider_class"
            value="org.hibernate.connection.C3P0ConnectionProvider" />
        <property name="hibernate.c3p0.min_size" value="5" />
        <property name="hibernate.c3p0.max_size" value="20" />
        <property name="hibernate.c3p0.timeout" value="1800" />
        <property name="hibernate.c3p0.max_statements" value="50" />

        <property name="hibernate.connection.provider_class" value="org.jasypt.hibernate3.connectionprovider.EncryptedPasswordC3P0ConnectionProvider" />
        <property name="hibernate.connection.encryptor_registered_name" value="myHibernateStringEncryptor" />
        <property name="hibernate.connection.password" value="ENC(xxxxxxxxxx)" />


    </properties>

</persistence-unit>

le pom.xml

<dependency> <groupId>org.jasypt</groupId> <artifactId>jasypt</artifactId> <!-- <version>1.9.2</version> --> <version>1.9.3</version> </dependency> <dependency> <groupId>org.jasypt</groupId> <artifactId>jasypt-hibernate3</artifactId> <!-- <version>1.9.2</version> --> <version>1.9.3</version> </dependency>