airavata-courses / TeamAlpha

Team Alpha's Repository for Spring 2016 I590 Class
0 stars 0 forks source link

Database authentication issue while logging in to your application #30

Closed a2l007 closed 8 years ago

a2l007 commented 8 years ago

Hello team, I've followed your instructions and installed the application. Also, I've created a new user and tried logging in with the new user credentials. However, this throws the following error:

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres" org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:245) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

Do i need to update the database credentials in any config file?

patel99 commented 8 years ago

Hi Atul,

Yes you will have to supply your db username and password in applicationContext.xml;

This file is present at "Airavata_Remote_Job_Runner/WebContent/WEB-INF/spring/application_servlets/applicationContext.xml"

I will add that to instructions. Thanks

a2l007 commented 8 years ago

I set the password for my database as root and ran the application, but I'm still facing the same issue.

patel99 commented 8 years ago

Did you run ddl and dml database scripts? Can you once check if database and tables are created? After setting password as 'root' are you still getting 'password authentication failed' error?

a2l007 commented 8 years ago

Sorry for the delayed update. The error that I'm hitting is: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"

I tried changing the username to 'root' in applicationContext.xml. But this gives me the same error with user as 'postgres'. Are there any other files that needs to be updated other than applicationContext.xml

patel99 commented 8 years ago

Hi,

You should put password for user 'postgres' that you have set. In our case we used 'root' as password while setting up the postgres databse. I suspect that you have setup some other password for that.

And you need to do this only as postgres user, that is why we have included steps in out wiki to check if user 'postgres' is present in database.

Username - postgres Password - [Your_personal_password_which_you_setup]

a2l007 commented 8 years ago

What i meant to say was, even if i change the username from postgres to some other value, the error message still specifies that the authentication has failed for username 'postgres'.

Further, I executed the SELECT query on the pg_user table and it returned a row for the postgres user. We can check this tomorrow if you have time.