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

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Did someone hard-code the schema inside the code or in a configuration file?

Did this ever work?  If so, what changed?
cloudtechnicianAuthor 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.
slightwv (䄆 Netminder) Commented:
>> it's just described in configuration file.

Maybe the config file changed since everything was last restarted.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

cloudtechnicianAuthor Commented:
If we restore WEBAPPS folder with old backup will it make any changes at the database, will the scripts execute again?
slightwv (䄆 Netminder) 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.
cloudtechnicianAuthor 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.
slightwv (䄆 Netminder) 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.
cloudtechnicianAuthor 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.
slightwv (䄆 Netminder) 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.
cloudtechnicianAuthor 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.
slightwv (䄆 Netminder) 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.