Avatar of cloudtechnician
 asked on

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.
JavaJava App ServersApplication ServersDatabasesOracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
slightwv (䄆 Netminder)

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

Did this ever work?  If so, what changed?

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)

>> it's just described in configuration file.

Maybe the config file changed since everything was last restarted.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

If we restore WEBAPPS folder with old backup will it make any changes at the database, will the scripts execute again?
slightwv (䄆 Netminder)

>> 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.

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.
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
slightwv (䄆 Netminder)

>>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.

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)

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.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

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)

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.