facebook

[Weblogic 8.1sp3] Can’t import javax.servlet.http.* classes

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #275112 Reply

    Marc
    Member

    When running a WebLogic 8.x server instance from MyEclipse IDE, the server starts as it should but when a reference to a java servlet is loaded by the VM the following stack trace is displayed in the “Console” tab in eclipse:

    java.lang.Error: Unresolved compilation problems:
    The import javax.servlet.http.HttpServletRequest cannot be resolved
    The import javax.servlet.http.HttpServletResponse cannot be resolved
    The import javax.servlet.http.HttpSession cannot be resolved
    HttpServletRequest cannot be resolved to a type
    HttpServletResponse cannot be resolved to a type
    HttpSession cannot be resolved to a type
    The method getServletContext() is undefined for the type ActionServlet
    The method getServletContext() is undefined for the type ActionServlet
    The method getServletContext() is undefined for the type ActionServlet
    The method getServletContext() is undefined for the type ActionServlet
    The method getServletContext() is undefined for the type ActionServlet

    at com.truecontext.mxforms.presentation.dispatcher.handlers.FormAppsListPreActionHandler.<init>(FormAppsListPreActionHandler.java:11)
    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:274)
    at java.lang.Class.newInstance0(Class.java:308)
    at java.lang.Class.newInstance(Class.java:261)
    at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:206)
    at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:324)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at com.truecontext.wasabi.presentation.filters.SessionMgmtFilter.doFilter(SessionMgmtFilter.java:209)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    The same web application can run when started from the WebLogic batch files but cannot run when running in myeclipse. The seems to be related to a classpath issue but the “weblogic.jar” contains the required classes in the Server configuration under the “Append to classpath” list box under the “WebLogic 8.x–> Paths”.

    This issue is preventing me from running and debugging web applications in myeclipse.

    #275116 Reply

    Marc
    Member

    After further diagnostics, the problem seems to be related to the compilation of the project in myeclipse.

    I setup my environment by importing my project in myeclipse and then adding the following capabilities via the “MyEclipse” context menu on the project:
    1. Add Web Project Capabilities…: the following options were used
    i) J2EE 1.3
    ii) I unchecked the “Add J2EE libraries to buildpath” because I’m the weblogic.jar already has the required dependencies.

    2. Add Struts Capabilities…: the following options were used
    i) Selected Struts 1.1
    ii) Unchecked the “Install Struts jar” and “Install Struts TLDs” checkboxes

    If the project compiles properly and the same libraries are referenced in the build and runtime environment what could be causing the issues I’m currently seeing?

    Turning off the “Build Automatically” option in the IDE and using my standard ANT tasks to compile my project resolved the problem. I can now deploy and debug the project from the IDE with the configured server instance.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: [Weblogic 8.1sp3] Can’t import javax.servlet.http.* classes

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in