• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting ClassNotFoundException, but the class is there!

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using WL 9.2.2. When trying to pass control off to a servlet, I get

javax.servlet.ServletException: [HTTP:101249][weblogic.servlet.internal.WebAppServletContext@9a6e58 - appName: 'nps_config_gui', name: 'nps_config_gui.war', context-path: '/nps_config_gui']: Servlet class com.comcast.npsconfig.jsf.controllers.LoginSuccessServlet for servlet LoginSuccessServlet could not be loaded because the requested class was not found in the classpath .
java.lang.ClassNotFoundException: com.comcast.npsconfig.jsf.controllers.LoginSuccessServlet.
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:519)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:525)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261)
at com.comcast.nps.im.plugin.NPSIMIntercepter.doFilter(NPSIMIntercepter.java:106)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3229)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

This baffles me because when I unzip my WAR file, the class is in my WEB-INF/classes directory. That's where WL looks for classes right, in addition to the classpath set in the server? If it is useful, attached is my web.xml file. Thanks for any advice, - Dave

=====================start web.xml file=====================
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<filter>

<filter-name>SSOFilter</filter-name>
<filter-class>com.comcast.nps.im.plugin.NPSIMIntercepter</filter-class>
<init-param>
<param-name>filter_conf_file</param-name>
<param-value>/export/third-party/etsbea/application_conf/wls_9.2.2/nps_config_gui_conf/nps_im_plugIn.properties</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>SSOFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Faces Servlet
Marty Hall: changed .jsf back to standard of .faces -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<description>
</description>
<display-name>
LoginSuccessServlet</display-name>
<servlet-name>LoginSuccessServlet</servlet-name>
<servlet-class>
com.comcast.npsconfig.jsf.controllers.LoginSuccessServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LoginSuccessServlet</servlet-name>
<url-pattern>/LoginSuccessServlet</url-pattern>
</servlet-mapping>

<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>

<!-- Welcome files -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>

</web-app>
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This can be due a class loading issue. See if you have this class in more places in the classpath. Any compile problems?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. Everything is compiling fine. Although I do have classes with

om.comcast.npsconfig.different_folders

in a JAR file in my WEB-INF/lib directory and then I have this class in WEB-INF/classes/com/comcast/npsconfig/jsf/controllers/LoginSuccessServlet.

Could this be causing the issue? Any way to check how the ClassLoader is looking for classes?

Thanks, - Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic