-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Password Encryption with JBOSS
PostPosted: Mon Mar 16, 2009 11:05 am 
Newbie

Joined: Thu Nov 13, 2008 4:38 am
Posts: 4
I want that hibernate get the encrypted password from C:\jboss-3.2.7\server\default\conf\login-config.xml programatically. Problem is somewhere in step 3. How to tell the Configuration to get the encrypted password from the login-config.xml. I got the following exception

javax.ejb.EJBException: Couldn't create resource The user must supply a JDBC connection

Using the following configuration.

1: in login-config.xml

<application-policy name="EncryptDBPassword">
<authentication>
<login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
<module-option name="username">root</module-option>
<module-option name="password">5b11a0839b6fa9be6eaf1b129639c6a8</module-option>
<module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=jdbc/dataSource</module-option>
</login-module>
</authentication>
</application-policy>

2: in C:\jboss-3.2.7\server\default\deploy\mysql-ds.xml

<local-tx-datasource>
<jndi-name>jdbc/dataSource</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!--user-name>root</user-name>
<password>Nb/U4LQbFbyi9p0Q7LUiJw==</password-->
<security-domain>EncryptDBPassword</security-domain>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
</local-tx-datasource>

3: In Hibernate Util

Configuration configuration = new Configuration()
.addResource("com/test/hib/Employee.hbm.xml");
configuration.setProperty("hibernate.session_factory_name","jdbc/dataSource");
sessionFactory = configuration.buildSessionFactory();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.