Search code examples
javaspring-mvctomcatweblogic-10.xwebjars

webjars for angularjs Failed to Load 404 in Weblogic, which is working in Tomcat


I am trying to migrate application from Tomcat to Weblogic. I am using Spring , Hibernate and build tool. I could able deploy and login , but from Home page , it is not loading because of Angular JS is not loaded. It was working good in Tomcat, but in Weblogic 10.3.6, I could able to figure it out.

POM.xml

<dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>2.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>angularjs</artifactId>
            <version>1.3.1</version>
        </dependency>

mvc-dispatcher-servlet.xml

<mvc:resources mapping="/webjars/**" location="/webjars/"/>
    <mvc:resources mapping="/js/**" location="/js/"/>
    <mvc:resources mapping="/css/**" location="/css/"/>
    <mvc:resources mapping="/jquery/**" location="/jquery/"/>
    <mvc:resources mapping="/jqueryui/**" location="/jqueryui/"/>
    <mvc:resources mapping="/images/**" location="/images/"/>
    <mvc:resources mapping="/includes/**" location="/includes/"/>
    <mvc:resources mapping="/pages/**" location="/pages/"/>
    <mvc:resources mapping="/views/**" location="/views/"/>
    <mvc:resources mapping="/modals/**" location="/modals/"/>
    <mvc:resources mapping="/icons/**" location="/icons/"/>
    <mvc:resources mapping="/bootstrap/**" location="/bootstrap/"/>

I am not sure about what to add in weblogic.xml.

Please Note : Using Servlet 2.5


Solution

  • Try:

    <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>