1 Reply Latest reply: Jul 24, 2014 9:59 AM by Vijaya Moderator -Oracle RSS

    Fail to new HttpServlet in Win7 and within Weblogic 12.1.2/12.1.3

    user8024953

      Hi,

       

      I met a strange issue here. I built a war file and deployed it in weblogic, in which, some HttpServlets are defined.

       

      It works well in Linux, but when I tried it in Win7-64bit, below NPE is received:

       

      GET /customization/text HTTP/1.1

      User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20101219 Oracle/3.6.9-2.0.1.el6 Firefox/3.6.9

      Accept: application/json, text/javascript, */*; q=0.01

      Accept-Language: en-us,en;q=0.5

      Accept-Encoding: gzip,deflate

      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

      Keep-Alive: 115

      Connection: keep-alive

      X-Requested-With: XMLHttpRequest

      Referer: http://10.182.105.231:7001/partner-manager/index/main.html

       

       

      ]] Root cause of ServletException.

      java.lang.NullPointerException

        at CustomizeServlet.<init>(Unknown Source)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)

        at java.lang.Class.newInstance0(Class.java:374)

        at java.lang.Class.newInstance(Class.java:327)

        at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:246)

        at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:239)

        at weblogic.servlet.internal.WebComponentContributor.createServletInstance(WebComponentContributor.java:268)

        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.newServletInstanceIfNecessary(StubSecurityHelper.java:358)

        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:311)

        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288)

        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:98)

        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:86)

        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74)

        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:60)

        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:34)

        at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:652)

        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:593)

        at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:403)

        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:295)

        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3363)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333)

        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:2220)

        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)

        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)

        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)

        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)

        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)

        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

      >

       

      In which, CustomizeServlet is the servlet I wrote. Below is my web.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.

      //DTD Web Application 2.3//EN"

      "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

       

       

      <web-app>

        <servlet>

          <servlet-name>ProxyServlet</servlet-name>

          <servlet-class>weblogic.servlet.proxy.HttpProxyServlet</servlet-class>

          <init-param>

            <param-name>redirectURL</param-name>

            <param-value>http://10.182.14.10:8001</param-value>

            <!--param-value>http://10.182.12.150:8001</param-value-->

          </init-param>

        </servlet>

       

       

        <servlet>

          <servlet-name>UploadServlet</servlet-name>

          <servlet-class>UploadServlet</servlet-class>

        </servlet>

       

       

        <servlet>

          <servlet-name>CustomizeServlet</servlet-name>

          <servlet-class>CustomizeServlet</servlet-class>

        </servlet>

       

       

        <servlet>

          <servlet-name>SysConfigServlet</servlet-name>

          <servlet-class>SysConfigServlet</servlet-class>

        </servlet>

       

       

        <servlet-mapping>

          <servlet-name>CustomizeServlet</servlet-name>

          <url-pattern>/customization/*</url-pattern>

        </servlet-mapping>

       

       

        <servlet-mapping>

          <servlet-name>SysConfigServlet</servlet-name>

          <url-pattern>/setting/sysConfig</url-pattern>

        </servlet-mapping>

       

        <servlet-mapping>

          <servlet-name>SysConfigServlet</servlet-name>

          <url-pattern>/setting/sysConfig/*</url-pattern>

        </servlet-mapping>

       

       

        <servlet-mapping>

          <servlet-name>UploadServlet</servlet-name>

          <url-pattern>/upload</url-pattern>

        </servlet-mapping>

       

       

        <servlet-mapping>

          <servlet-name>ProxyServlet</servlet-name>

          <url-pattern>/prm_pm_rest/*</url-pattern>

        </servlet-mapping>

       

       

        <!--welcome-file-list>

          <welcome-file>login.html</welcome-file>

        </welcome-file-list-->

      </web-app>

       

      And below is my weblogic.xml:

       

      <?xml version='1.0' encoding='UTF-8'?>

      <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

       

       

        <session-descriptor>

          <debug-enabled>true</debug-enabled>

        </session-descriptor>

        <!--This parameter defines the root directory of the URL -->

        <context-root>/</context-root>

        <servlet-descriptor>

          <servlet-name>ProxyServlet</servlet-name>

        </servlet-descriptor>

      </weblogic-web-app>

       

      Can anyone provide help on this?

       

      Thanks so much!