I created a WAR file HelloWorld_5.war for a HelloWorld5 project by copying all the jar files needed by the project into HelloWorld5\WEB-INF\lib folder and then deploying HelloWorld5\HelloWorld_5.war to Weblogic 12.11 server.
cfw-env-7.0.6.jar is one of the jars that is added to HelloWorld5\WEB-INF\lib folder
Before adding cfw-env-7.0.6.jar to HelloWorld5\WEB-INF\lib folder and creating the WAR file, I was getting the below noclassdeffounderror for package com/csg/cs/core/base/common/util/cfg/ConfigUtil
This was because this class is defined in cfw-env-7.0.6.jar which was not yet part of the HelloWorld_5.war .
As you can see in below, output, jar -tvf cfw-env-7.0.6.jar revealed that com.csg.cs.core.base.common.util.cfg.ConfigUtil package was part of cfw-env-7.0.6.jar jar file.
9220 Thu Apr 04 18:39:26 EDT 2013 com/csg/cs/core/base/common/util/cfg/ConfigUtil.class
So I copied this jar file cfw-env-7.0.6.ja to HelloWorld5\WEB-INF\lib. After adding cfw-env-7.0.6.jar to HelloWorld5\WEB-INF\lib and re-creating WAR file and redeploying to Weblogic, above ConfigUtil error goes away and I am getting a different noclassdefounderror for com/csg/cs/core/CoreState shown further below.
I donot understand this because this class is also defined in cfw-env-7.0.6.jar.
jar -tvf cfw-env-7.0.6.jar output as shown below reveals that along with ConfigUtil.class and a bunch of other classes, com.csg.cs.core.CoreState.class is also part of cfw-env-7.0.6.jar
2115 Thu Apr 04 18:39:26 EDT 2013 com/csg/cs/core/CoreState.classCan you please explain why I get the java.lang.NoClassDefFoundError: com/csg/cs/core/CoreState error even after including cfw-env-7.0.6.jar in HelloWorld5\WEB-INF\lib and creating a new WAR file with it ?Below are error messages I got before adding cfw-env-7.0.6.jar to the WAR file (which makes sense) and what i got after adding cfw-env-7.0.6.jar to the WAR (which doesnot make sense.Please explain)
After deploying the HelloWorld_5.war to weblogic server I am running URL and initially get the index.jsp page which in turn calls Servlet HelloWorld5BankController.class. This class internally calls logger.isLoggable method at which point it generates an error related to CoreState in the browser. The call to logger.isLoggable in HelloWorld5BankController.java is given further below
ERROR before adding cfw-env-7.0.6.jar to the WAR file which makes senseError 500--Internal Server Error
java.lang.NoClassDefFoundError: com/csg/cs/core/base/common/util/cfg/ConfigUtil at com.csg.cs.core.base.logging.LoggerHelper.createLoggerManager(LoggerHelper.java:119) at com.csg.cs.core.base.logging.LoggerHelper.getLoggerManager(LoggerHelper.java:111) at com.csg.cs.core.base.logging.LoggerHelper.getLogger(LoggerHelper.java:188) at com.csgtest.HelloWorld5BankController.(HelloWorld5BankController.java:24) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:357) at java.lang.Class.newInstance(Class.java:310) at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:236) at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:229) at weblogic.servlet.internal.WebComponentContributor.createServletInstance(WebComponentContributor.java:258) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.newServletInstanceIfNecessary(StubSecurityHelper.java:320) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:273) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:250) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:94) at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:82) at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74) at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:60) at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:34) at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:624) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:565) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:281) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: java.lang.ClassNotFoundException: com.csg.cs.core.base.common.util.cfg.ConfigUtil at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
ERROR after adding cfw-env-7.0.6.jar to the WAR file and re-deploying which doesnot make sense because I no more get the above ConfigUtil class not found error which means Weblogic is able to find the cfw-env.7.0.6.jar but strangely still cannot find CoreState package
Error 500--Internal Server Error
java.lang.NoClassDefFoundError: com/csg/cs/core/CoreState at com.csg.cs.core.base.logging.impl.ContextAwareLoggerDelegate.getTraceLevel(ContextAwareLoggerDelegate.java:96) at com.csg.cs.core.base.logging.impl.ContextAwareLoggerDelegate.isLoggable(ContextAwareLoggerDelegate.java:82) at com.csg.cs.core.base.logging.impl.AbstractLogger.isLoggable(AbstractLogger.java:261) at com.csg.cs.core.base.logging.impl.LoggerImpl.isLoggable(LoggerImpl.java:70) at com.csgtest.HelloWorld5BankController.process(HelloWorld5BankController.java:53) at com.csgtest.HelloWorld5BankController.doGet(HelloWorld5BankController.java:36) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
As you can see in the stack trace of error above, after Process is called in my Servlet class HelloWorld5BankController, isLoggable function is called.
Inside my Servlet class HelloWorld5BankController.class the point where isLoggable is called is as follows
private void process(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { if (req.getSession().getAttribute(CS_CUSTOMER) == null) { CSBankData bankData = new CSBankData(); Customer customer = (Customer) bankData.getCustomer(ContextHelper .getCoreContext().getPID()); req.getSession().setAttribute(CS_CUSTOMER, customer); if (logger.isLoggable(Level.FINEST)) { logger.finest("Customer " + customer); } } executeTX(req); String page = (String) req.getParameter("page"); [COLOR="#800080"]if (logger.isLoggable(Level.FINEST)) [/COLOR]{ logger.finest("Forwarding to page " + page); } req.getSession().getServletContext() .getRequestDispatcher("/" + page + ".jsp").forward(req, resp); }