Java Application is Unable to connect to correct schema(Error : 404)

cloudtechnician
cloudtechnician used Ask the Experts™
on
While trying to start the tomcats we're getting 404 error message in application logs. When looking at the application logs it shows that application is trying to connect to some other schema instead looking/connecting to it's defined schema. Also, we're unable to start any tomcat now.

Below are the application logs :

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-configuration/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: language in COMPLIANCE.ANALYSIS_WORD_LIST

Could someone please suggest why is it happening. Actual schema name is not (COMPLIANCE), Actual schema is ABC_UAT, unable to understand why the hell is it looking for a column in a table which is in another schema.
PS : we're using Oracle.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Did someone hard-code the schema inside the code or in a configuration file?

Did this ever work?  If so, what changed?

Author

Commented:
We just restarted the tomcats on both the instances where application is deployed, after that this problem started.

There is no hardcoding of schema inside the code, it's just described in configuration file.

It was working pretty well before restarting the tomcats.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>> it's just described in configuration file.

Maybe the config file changed since everything was last restarted.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
If we restore WEBAPPS folder with old backup will it make any changes at the database, will the scripts execute again?
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>> will the scripts execute again?

I don't know.  I only know Oracle.  If the config files changed then I probably wouldn't just try to replace them.  They likely changed for a reason.

Author

Commented:
Yes, we've confirmed that it looks Oracle issue, We locked the application account and restarted the tomcats to verify if application is trying to make connection to same schema and noticed in the logs it found out that the account is locked, which means it's trying to connect to the same schema but the question arises is why is it trying to make connection from other schema and reporting missing table in another schema. No where in application it's mention to connect to another schema. What is causing it to look for another schema.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>>but the question arises is why is it trying to make connection from other schema and reporting missing table in another schema

I cannot say.  Oracle doesn't just randomly pick tables to access.  Something somewhere is telling the app to look for that table in that schema.  Maybe the app uses a view that uses that table?

Did someone log into the database and remove the column form the table in the compliance schema?

I would log into the database and describe the table COMPLIANCE.ANALYSIS_WORD_LIST.  See what columns are in it.

Author

Commented:
We don't hard code any schema references in our code. I have also verified the entire codebase and did not find any places where we switch schemas. We inject JDBC datasource from Tomcat JNDI context. Connection parameters are configured in server.xml file in Tomcat’s conf directory.

I'm still confuse why is the wrong schema being called.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
If it isn't in your app code, then it either has to be in tomcat itself or in the database.

You might check the DBA_DEPENDENCIES view to see what might be dependent on COMPLIANCE.ANALYSIS_WORD_LIST.  That might give you an idea what might be accessing it.

http://docs.oracle.com/cd/E11882_01/server.112/e40402/statviews_3148.htm#REFRN23053

Author

Commented:
Finally, we spun up an instance from the old DB AMI and pointed the application to the new DB. Application started working after pointing it to new DB. Looks like it was some sort of permission issue.
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
>>Looks like it was some sort of permission issue.

Don't see how it would be a permission issue.  You really can't grant or restrict selects on a specific column.

The error message states that it found the table but could not locate the column in the table.

log into both databases and describe the tables.  Make sure they have the same columns

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial