2013-01-29 1 views
0

JSF/Primefaces 프로젝트에서 JPA + Hibernate 4.5.1을 사용하려고합니다. 연결 풀링에 c3p0을 사용하고 있습니다. 응용 프로그램이 시작될 때 c3p0은 풀을 초기화하려고 시도하지만 인증은 실패합니다.JPA/Hibernate와 Jasypt를 사용하는 설정

<persistence-unit name="ba"> 

    <properties> 
     <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/> 
     <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://x.x.x.x:1433/ba"/> 
     <property name="hibernate.connection.username" value="ba"/> 
     <property name="hibernate.connection.password" value="ENC(UcsChwXw5vYnM7w2S9XUaw==)" />    
     <property name="hibernate.connection.provider_class" value="org.jasypt.hibernate4.connectionprovider.EncryptedPasswordC3P0ConnectionProvider"/> 
     <property name="hibernate.connection.encryptor_registered_name" value="configurationHibernateEncryptor"/> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/> 
     <property name="hibernate.connection.release_mode" value="on_close"/> 
     <property name="hibernate.archive.autodetection" value="class, hbm"/> 
     <property name="hibernate.show_sql" value="true"/> 
     <property name="hibernate.c3p0.validate" value="true"/> 
     <property name="hibernate.c3p0.min_size" value="5"/> 
     <property name="hibernate.c3p0.max_size" value="20"/> 
     <property name="hibernate.c3p0.timeout" value="8"/> 
     <property name="hibernate.c3p0.max_statements" value="50"/> 
     <property name="hibernate.c3p0.preferredTestQuery" value="SELECT 1;"/> 
     <property name="hibernate.c3p0.idle_test_period" value="5"/> 
     <property name="hibernate.c3p0.idle_test_period" value="1200"/> 
     <property name="hibernate.c3p0.acquire_increment" value="1"/> 
    </properties> 

</persistence-unit> 

내가 넣어 한 ServletContextListener에 다음과 같은 :

@Override 
    public void contextInitialized(ServletContextEvent contextEvent) { 
    StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor(); 
    strongEncryptor.setAlgorithm("PBEWithMD5AndDES"); 
    strongEncryptor.setPassword("password");  
    HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); 
    registry.registerPBEStringEncryptor("configurationHibernateEncryptor", strongEncryptor); 

}

이 "오류"라인은 다음과 같습니다

내의 persistence.xml이다
INFO: Initializing c3p0 pool... [email protected] 
d [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSou 
[email protected] [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDe 
lay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterA 
cquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> n 
ull, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTest 
er, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, 
forceIgnoreUnresolvedTransactions -> false, identityToken -> 2rxe6q8s1103xfe10g 
g38n|1712f3d, idleConnectionTestPeriod -> 1200, initialPoolSize -> 3, maxAdminis 
trativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 8, maxIdleTimeExcess 
Connections -> 0, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnec 
tion -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManag 
[email protected] [ description -> null, driverClass -> null, factoryClassLo 
cation -> null, identityToken -> 2rxe6q8s1103xfe10gg38n|bc294a, jdbcUrl -> jdbc: 
jtds:sybase://x.x.x.x:yyyy/crystal, properties -> {encryptor_registered_name= 
configurationHibernateEncryptor, user=******, password=******, autocommit=true, 
release_mode=auto} ], preferredTestQuery -> null, propertyCycle -> 0, statementC 
acheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnecti 
onOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflecti 
veProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLoc 
ation -> null, identityToken -> 2rxe6q8s1103xfe10gg38n|1976f39, numHelperThreads 
-> 3 ] 


Jan 29, 2013 11:16:25 AM com.mchange.v2.resourcepool.BasicResourcePool$Scattered 
AcquireTask run 
WARNING: com[email protected]1de3 
1b1 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to 
acquire a needed new resource, we failed to succeed more than the maximum number 
of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: Login failed for user 'xxxxx'. 
     at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.j 
ava:372) 
     at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) 
     at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) 
     at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:603) 
     at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java 
:352) 
     at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java 
:50) 
     at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:185) 
     at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManag 
erDataSource.java:134) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
on(WrapperConnectionPoolDataSource.java:183) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
on(WrapperConnectionPoolDataSource.java:172) 
     at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe 
sourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:152) 
     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResource 
Pool.java:1074) 
     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPe 
ndingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1061) 
     at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourc 
ePool.java:32) 
     at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.ru 
n(BasicResourcePool.java:1796) 
     at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Thre 
adPoolAsynchronousRunner.java:635) 

Jan 29, 2013 11:16:25 AM com.mchange.v2.resourcepool.BasicResourcePool forceKill 
Acquires 
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicR 
[email protected] is interrupting all Threads waiting on a resource to check o 
ut. Will try again in response to new client requests. 
Jan 29, 2013 11:16:25 AM com.mchange.v2.resourcepool.BasicResourcePool forceKill 
Acquires 
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicR 
[email protected] is interrupting all Threads waiting on a resource to check o 
ut. Will try again in response to new client requests. 
+0

로그에 무엇이 표시됩니까? 정확히 어떤 오류가 있습니까? – snow8261

+0

@ snow8261, 업데이트를 확인하십시오. – javaMS

답변