Thursday, February 5, 2015

EBS 12.2 --OACORE -- java.lang.NoClassDefFoundError: Could not initialize class oracle.apps.fnd.common.WebAppsContext

Recently, I have faced with a weird situation where I find myself again an inoperative EBS 12.2..
Login page was encountring the following error..

We are already familiar with the error "Failure of server Apache Bridge".. We know, that It appears when the oacore managed server is in shutdown status, or when the oacore managed server is in hang status..
But in this problem, oacore was running. Restarting oacore or even restarting the whole application tier was not a solution.

Further diagnosis showed that, the problem in oacore was the following;

 java.lang.NoClassDefFoundError: Could not initialize class oracle.apps.fnd.common.WebAppsContext

java.lang.NoClassDefFoundError: Could not initialize class oracle.apps.fnd.common.WebAppsContext
        at weblogic.servlet.internal.FilterManager$
        at weblogic.servlet.internal.FilterManager.loadFilter(
        at weblogic.servlet.internal.FilterManager.preloadFilters(
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(
        at weblogic.servlet.internal.WebAppServletContext.start(
        at weblogic.servlet.internal.WebAppModule.startContexts(
        at weblogic.servlet.internal.WebAppModule.start(
        at weblogic.application.internal.flow.ModuleStateDriver$
        at weblogic.application.utils.StateMachineDriver.nextState(
        at weblogic.application.internal.flow.ModuleStateDriver.start(
        at weblogic.application.internal.flow.ScopedModuleDriver.start(
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(

So ,basically there was problem in loading classes, as java could not find the the class named WebAppsContext..
This made me think that there was a classpath problem.. Someone could have changed something in Managed server configurations.. Maybe the classpath was changed....
According to this info, I decided to run an autoconfig in appsTier.

Autoconfig would change the configurations back to their factory defaults, or lets say to their proper values :)
But, autoconfig was also encountering errors. 2 scripts i n profile phase of autoconfig was not run successfully.
One of these scripts was ; afwebprf.sql.
The error at the top of the error stack  was : PL/SQL: numeric or value error: character to number conversion error..
When I looked at the sql script , I saw that ; the script was failing while checking the NODE_TRUST_LEVEL profile..

When I checked the value of that profile; I saw that it was set to "Y"

select * from (
select p.profile_option_name SHORT_NAME, n.user_profile_option_name NAME,
decode(v.level_id, 10001, 'Site', 10002, 'Application',
10003, 'Responsibility', 10004, 'User', 10005, 'Server',
10007, 'SERVRESP', 'UnDef') LEVEL_SET,
decode(to_char(v.level_id), '10001', '',
'10002', app.application_short_name,
'10003', rsp.responsibility_key,
'10005', svr.node_name,
'10004', usr.user_name,
'10007', 'Serv/resp',
'UnDef') "CONTEXT",
v.profile_option_value VALUE
from fnd_profile_options p,
fnd_profile_option_values v,
fnd_profile_options_tl n,
fnd_user usr,
fnd_application app,
fnd_responsibility rsp,
fnd_nodes svr,
hr_operating_units org
where p.profile_option_id = v.profile_option_id (+)
and p.profile_option_name = n.profile_option_name
and upper(n.user_profile_option_name) like '%'
and usr.user_id (+) = v.level_value
and rsp.application_id (+) = v.level_value_application_id
and rsp.responsibility_id (+) = v.level_value
and app.application_id (+) = v.level_value
and svr.node_id (+) = v.level_value
and org.organization_id (+) = v.level_value
order by short_name, level_set
) where LEVEL_SET='Site'
order by name

So, this profile should have been set to a number not a char! ("Y")..
This was a clear problem, so I have updated it using the following;

stat boolean;
IF stat THEN
dbms_output.put_line( 'Stat = TRUE - profile updated' );
dbms_output.put_line( 'Stat = FALSE - profile NOT updated' );

This action have fixed the problem , but only for afwebprf.sql...
Other scripts in autoconfig's profile phase was also encountering the same error; "PL/SQL: numeric or value error: character to number "

To analyze further, I checked another script, it was trying to read the orgid profile..
When I checked the orgid profile setting in site and user level, I have seen that they all were set to "Y"..

This showed me that the problem is clearly in fnd_profile_option_values.. Someone could have updated the fnd_profile_option_values wrongly, using a direct update statement.. I say "direct update statement" because using psql apis or EBS forms screens , something like this could not be done.. I mean, you just cant set a profile  to a abnormal value using Standart screens..
Also, finding orgid profile values changed to "Y" made me think that this may be a widespread problem.. Thus, there could be some other profiles which may also be affected.. Especially some profiles which might have affect loading of classes in some way..(remembering the actual error : java.lang.NoClassDefFoundError: Could not initialize class oracle.apps.fnd.common.WebAppsContext)

For the solution;
I used flashback query, get the rows from the unchanged fnd_profile_option_values using "as of timestamp option"  and created a table named fnd_profile_option_values_erm.. Then I renamed the fnd_profile_option_values to fnd_profile_option_values_err and renamed fnd_profile_options_erm to fnd_profile_otpions..
Lastly , compiled the invalid objects and started the application services..
That was all.. The problem have dissapeared..

 In conclusion;

We have seen that a problem/unexpected value in profile options of EBS  may lead to service level problems..
In such problems, the cause may not be the things which come our minds in the first thoughts. As you see above, a situation which may be seen like a classpath problem, may actually be a profile problem..
EBS is complex system, and almost everyting is connected with everyting.. Keep in mind that..
Lastly, It is needles to say, updating data using generic update statements is dangerous in EBS :) 

No comments :

Post a Comment

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link:

Register and create an issue in the related category.
I will support you from there.