开发者

Weblogic 10.3 - Servlet failed with Exception

开发者 https://www.devze.com 2023-01-22 06:51 出处:网络
I am trying to upgrade my application from Weblogic 8.1 SP 6 to Weblogic 10.3. For this, I have installed Weblogic 10.3 and created a domain. WLS 10.3 started successfully from my domain.

I am trying to upgrade my application from Weblogic 8.1 SP 6 to Weblogic 10.3. For this, I have installed Weblogic 10.3 and created a domain. WLS 10.3 started successfully from my domain. I recomplied the code in Java 1.6 and deployed successfully with out any code changes.

I have deployed the application and trying to launch the application welcome (login) page.

Then I am seeing the below error :

Predefined Constants Object: com.abc.xyz272.businessclasses.PredefinedConstants@3d80183
DataSourceName='null'
sessionTimeOutLimit='36000'
00:39:31==>Servlet:  getRemoteUser=null
00:39:31==>Servlet:  getHeader=null
00:39:31==>count=0
<Oct 29, 2010 12:39:31 AM MDT> <Error> <HTTP> <BEA-101020> <[weblogic.servlet.internal.WebAppServletContext@2e28f75 - appName: 'mbqccrpt', name: 'xyzControllerServlet', context-path: '/xyzControllerServlet', spec-version: 'null'] Servlet failed with Exception
java.lang.NullPointerException
        at com.abc.xyz272.servlets.xyzControllerServlet.processRequest(Unknown Source)
        at com.abc.xyz272.servlets.xyzControllerServlet.doPost(Unknown Source)
        at com.abc.xyz272.servlets.xyzControllerServlet.doGet(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.h开发者_Python百科ttp.HttpServlet.service(HttpServlet.java:820)
        Truncated. see log file for complete stacktrace

I have one more question. The application running on Weblogic 8.1 is using apache server as well for launching the Static pages. For upgrading the application in weblogic 10.3 do we require the apache server?


I can answer the 2nd part of your question.

The main purpose usually used for an Apache server fronting the Weblogic is to offload static contents such as images,HTMLs, JS, CSS files to the Apache web server. Only dynamic requests are passed on to the Weblogic, thus reducing traffic especially if across a firewall.

This is an architectural decision which does not depend on the version of Weblogic. Rather, this depends on certain concerns such as Clustering of the App servers (using Apache as a load balancer), Volume of static data since Apache serves static data quite fast - so why push that load onto Weblogic.

And regarding your NullPointerException, it seems to be because your datasource is not defined properly (it shows as null) but you are calling some operations on it


Few Weeks Back, I was also here on this page, filtering out the internet for a suitable solution for this very same problem spec-version: 'null'] Servlet failed with Exception, until the time when everything else didn't work except the solution which I found myself after a lot of effort.

I encountered this issue while migrating one application from Oracle's 10g App Server to Weblogic 10.3.5.

As per the legendary practice, while doing the migration, we had placed one weblogic.xml file in the /WEB-INF/ folder and that was the actual problem. I just replaced that incorrect weblogic.xml file with my own version of weblogic.xml file and things worked fine.

Even though the faulty weblogic.xml file had many other elements inside the root element for the reasons best known to the person who had initially placed it, in my version of this DD file I had only the root element. And so finally the problem was resolved. So it's worth to take this into consideration.


getRemoteUser() returning null:

As getRemoteUser() method is deprecated in Weblogic 10.3, it will return null when the application is accessed by users. To avoid this problem replace getRemoteUser() with thegetHeader(“proxy-remote-user”) method, to return the remote-user as a string.

String usr= request.getHeader("proxy-remote-user");

Issue with Servlet Path Mapping:

We have the following Servlet mapping in web.xml which was working fine in Weblogic 8.1

<servlet-mapping> in web.xml 
  <servlet>
      <servlet-name>ServletName</servlet-name>
      <servlet-class>com.abc.servlets.servletname</servlet-class>
  </servlet>
   <servlet-mapping>
      <servlet-name> ServletName </servlet-name>
      <url-pattern>/*.*</url-pattern>
  </servlet-mapping>

But after migrating to 10.3, the same Servlet mapping is not working as the request is going into the infinite loop while launching the application home page. Since the web application is using Servlet as a controller where all the requests hits the controller and then are forwarded to respective JSP’s. To avoid this problem we replaced url-pattern “/*” with “/” in the servlet-mapping as below.

 <servlet-mapping>
      <servlet-name> ServletName </servlet-name>
      <url-pattern>/ServletName </url-pattern>
 </servlet-mapping>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号