Search code examples
javaweb-applicationsservletsweblogicweblogic-10.x

War deploy from Tomcat 7 to Weblogic 10.3.5 doesn't work


I'm trying to deploy a war file into Weblogic 10.3.5 but it's now working. The same file is deployed with success in Tomcat 7 and the app runs gracefully.

However, when I try to deploy it in Weblogic using the default settings for the deploy plan and so on, it raises a NullPointerException error in a ServletContextListener implementation that I have. My question is: Do I need to change something in the application like to add the weblogic.xml file? Do I need something else?

I noticed that if I point my deployment to a folder which contains the exploded war content, the application runs with a few errors, but at least the main screen opens fine (it's an applet based application).

**UPDATED

Here is the exception I'm getting when I try to start the app.

####<Oct 29, 2012 5:27:12 AM PDT> <Warning> <HTTP> <ip-0A2E9E72> <AdminServer> 
<[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> 
<<WLS Kernel>> <> <> <1351513632838> <BEA-101162> 
<User defined listener artemispm.web.ui.gwt.server.A7WebStartupListener failed: 
java.lang.NullPointerException.java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at java.util.Properties.setProperty(Properties.java:143)
at java.lang.System.setProperty(System.java:729)

Solution

  • Ok, I figured out what was the issue. Weblogic was returning null when I was trying to call

    String path = servletContextEvent.getServletContext().getRealPath("/");
    

    Then I was trying to add that path variable to the System properties and according to the java documentation it throws a NullPointerException when we try to add null values to a HashMap.

    So, in order to enable web applications to retrieve the real path we need to configure a property from our Weblogic's domain. I went to Weblogic's console, then clicked on domain's name -> Web Applications tab. Find the Archived Real Path Enabled option and check it. You'll need to restart the server.

    Thanks everyone,

    Gyo