user6309529
user6309529

Reputation: 163

Unable to migrate my WAR file from Tomcat to Weblogic 12c

I'm trying to migrating my web service from Tomcat 8.5 to Weblogic 12c. My project works well on Tomcat, so I was expecting it will be fine too since both of them were using same version of Java.

After I deployed my WAR using Weblogic console, it say its condition is fine and running. But when I connect to it using Chrome, it gives Error 500 all the time. It is hard to guess what is it going wrong even I dig into Weblogic's log

<Error> <HTTP> <AdminServer> <[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <f21f82c8-a7fe-4d00-9ead-58094613f623-00000045> <1513072074680> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-101020> <[ServletContext@715231355[app:testCMS module:testCMS.war path:null spec-version:3.1]] Servlet failed with an Exception
java.lang.NullPointerException
    at weblogic.servlet.internal.ServletRequestImpl$CookieKey.hashCode(ServletRequestImpl.java:2084)
    at java.util.HashMap.hash(HashMap.java:338)
    at java.util.HashMap.get(HashMap.java:556)
    at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.getSessionIDFromMap(ServletRequestImpl.java:2819)
    at weblogic.servlet.internal.ServletRequestImpl$SessionHelper._getSessionInternal(ServletRequestImpl.java:2902)
    at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.getSessionInternal(ServletRequestImpl.java:2869)
    at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.getSession(ServletRequestImpl.java:2859)
    at weblogic.servlet.internal.ServletRequestImpl.getSession(ServletRequestImpl.java:1513)
    at weblogic.servlet.internal.ServletResponseImpl.encodeURL(ServletResponseImpl.java:690)
    at weblogic.servlet.internal.ServletResponseImpl.encodeRedirectURL(ServletResponseImpl.java:673)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2226)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

Can anyone tell me how to solve this weird issue, please?

Upvotes: 1

Views: 1598

Answers (1)

user6309529
user6309529

Reputation: 163

Ok, I found the answer by myself.

It appear JSP website need an weblogic.xml inside WEB-INF folder with web.xml, so you'll be able to deploy your WAR with JSPs on Weblogic properly.

I'm not sure why Weblogic deployment required that file but others(e.g.: WAS/JBOSS/etc), don't have time to find out WHY for now.

In case that any other newbies on Weblogic developement faced this thing like me, I'll post weblogic.xml content here if you need an example like I was.

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
    <wls:weblogic-version>12.2.1.2</wls:weblogic-version>
    <wls:context-root>testCMS</wls:context-root>
</wls:weblogic-web-app>

Upvotes: 1

Related Questions