Announcement Announcement Module
Collapse
No announcement yet.
Weblogic 6.1 and spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weblogic 6.1 and spring

    Hi,

    Has anyone gotten weblogic 6.1 to work with Spring?

    I've tried, deployed my .war file etc. and everything seems to load okay in the console...however, when I try the page, I get a 404 error. I know the .war file works, as I can drop the same .war file in Tomcat 5.0.28 minus weblogic specific settings, and it works fine.

    Thanks

  • #2
    I think perhaps your appcontext and thus your web app maybe failed to load because of an error, if you are getting a 404. What does the log show when the app is coming up?

    Comment


    • #3
      You need to use ContextLoaderServlet instead of ContextLoaderListener in your web.xml when running on Weblogic. This is because unlike Tomcat, Weblogic runs the load-on-startup servlets before the servlet listeners.

      ie :
      <servlet>
      <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoade rServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>

      Sanjiv

      Comment


      • #4
        Sanjiv, Colin

        Thanks guys

        Hi Colin,

        The funny thing is that the webpage goes to 404, but the console doesn't read any errors. Console gives me the same output that is given from Tomcat 5.0.28, which runs the same page request succesfully

        Hi Sanjiv,

        I tried your suggestion, and the following occurs:
        itionReader] - <Loading XML bean definitions from resource [/WEB-INF/application
        Context.xml] of ServletContext>
        2004-11-16 00:02:27,426 ERROR [org.springframework.web.context.ContextLoader] -
        <Context initialization failed>
        org.springframework.beans.factory.BeanDefinitionSt oreException: IOException pars
        ing XML document from resource [/WEB-INF/applicationContext.xml] of ServletConte
        xt; nested exception is java.io.FileNotFoundException: Could not open resource [
        /WEB-INF/applicationContext.xml] of ServletContext
        java.io.FileNotFoundException: Could not open resource [/WEB-INF/applicationCont
        ext.xml] of ServletContext
        at org.springframework.web.context.support.ServletCon textResource.getInp
        utStream(ServletContextResource.java:73)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBea
        nDefinitions(XmlBeanDefinitionReader.java:125)
        at org.springframework.context.support.AbstractXmlApp licationContext.loa
        dBeanDefinitions(AbstractXmlApplicationContext.jav a:125)
        at org.springframework.context.support.AbstractXmlApp licationContext.ref
        reshBeanFactory(AbstractXmlApplicationContext.java :65)
        at org.springframework.context.support.AbstractApplic ationContext.refres
        h(AbstractApplicationContext.java:226)
        at org.springframework.web.context.support.XmlWebAppl icationContext.refr
        esh(XmlWebApplicationContext.java:131)
        at org.springframework.web.context.ContextLoader.crea teWebApplicationCon
        text(ContextLoader.java:156)
        at org.springframework.web.context.ContextLoader.init WebApplicationConte
        xt(ContextLoader.java:97)
        at org.springframework.web.context.ContextLoaderServl et.init(ContextLoad
        erServlet.java:80)
        at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
        at weblogic.servlet.internal.ServletStubImpl.createSe rvlet(ServletStubIm
        pl.java:744)
        at weblogic.servlet.internal.ServletStubImpl.createIn stances(ServletStub
        Impl.java:671)
        at weblogic.servlet.internal.ServletStubImpl.prepareS ervlet(ServletStubI
        mpl.java:616)
        at weblogic.servlet.internal.WebAppServletContext.pre loadServlet(WebAppS
        ervletContext.java:2411)
        at weblogic.servlet.internal.WebAppServletContext.pre loadServlets(WebApp
        ServletContext.java:2352)
        at weblogic.servlet.internal.HttpServer.preloadServle ts(HttpServer.java:
        571)
        at weblogic.servlet.internal.WebService.preloadServle ts(WebService.java:
        450)
        at weblogic.t3.srvr.ServletInitRunner.run(ServletInit Runner.java:49)
        at java.lang.Thread.run(Thread.java:479)

        Comment


        • #5
          The file is apparently not where it should be. This may be a silly question (since it was working with TomCat, but on the other hand that was with ContextLoaderListener, not Servlet) , but are you _sure_ it's in the web-app at /WEB-INF/applicationContext.xml?

          Colin

          Comment


          • #6
            weblogic 6.1 can be accessed /WEB-INF directory,you should use weblogic
            8.1,that has solved the problem

            Comment


            • #7
              Interesting. I found this url http://www.jguru.com/forums/view.jsp?EID=1038798 that goes over the details of the Weblogic 6.1 bug. Actually I don't think it is a real bug, rather a limitation since the Servlet documentation is pretty sketchy about reading files/resources from a virtual path like the WEB-INF dir in a war file. It allows 'null' to be returned if it cannot be mapped to a real path.

              Does Spring support loading of the applicaiton context file from the classpath (like placing it in the WEB-INF/classes dir) ?

              Sanjiv

              Comment


              • #8
                Originally posted by sjivan
                Interesting. I found this url http://www.jguru.com/forums/view.jsp?EID=1038798 that goes over the details of the Weblogic 6.1 bug. Actually I don't think it is a real bug, rather a limitation since the Servlet documentation is pretty sketchy about reading files/resources from a virtual path like the WEB-INF dir in a war file. It allows 'null' to be returned if it cannot be mapped to a real path.

                Does Spring support loading of the applicaiton context file from the classpath (like placing it in the WEB-INF/classes dir) ?

                Sanjiv
                You can not expect to always be able to get a real path for a resource inside a war file. It's perfectly legal for WebLogic to just serve resources directly out of the warfile with a special URL handler that it uses for this purpose.

                But that is not what is going on here. XmlWebApplicationContext never ends up using getRealPath(). The resource handling is via Spring's ServletContextResource class, which will always get the resource relative to the servlet context, in an approved fashion (servletContext.getResourceAsStream()) which should work in any compliant container.

                In any case, you certainly can override the config location and specify that it is on the classpath. In your web.xml, just point to the application context with the classpath: perfix, i.e.
                classpath:applicationContext.xml

                Comment


                • #9
                  Better explanation on my part + it still doesn't work

                  Hi Guys,

                  Thanks for all your help.

                  I retried my first attempt, for the sake of posting a better message, and did the following:

                  1st ATTEMPT
                  1. web.xml servlet entry
                  <servlet>
                  <servlet-name>tradingapp</servlet-name>
                  <servlet-class>
                  org.springframework.web.servlet.DispatcherServlet
                  </servlet-class>
                  <load-on-startup>1</load-on-startup>
                  </servlet>
                  2. tradingapp-servlet.xml is defined
                  3. no applicationContext.xml

                  Results were:
                  My startup is fine.

                  When I try to go my page, I get the following:
                  Console(Weblogic 6.1)
                  <21-Nov-04 20:26:50 GMT> <Info> <HTTP> <[WebAppServletContext(2116890,tradingapp,/tradingapp)] Generated java file: C:\Program Files\BEA\wlserver6.1\config\mydomain\applications \tradingapp\WEB-INF\_tmp_war_mydomain_myserver_tradingapp\jsp_s
                  ervlet\__index.java>
                  2004-11-21 20:27:02,687 INFO [org.springframework.web.servlet.view.InternalResou
                  rceViewResolver] - <Cached view 'logon'>

                  Browser:
                  the url is set correctly in the address, but I get a 404 error.
                  For example:
                  1. I typed http://localhost:7001/mydomain
                  2. index.jsp is the welcome file in web.xml. It core:redirects to /logon.htm
                  3. Even though 404 is given in browser page, Address is http://localhost:7001/mydomain/logon...ssionid=Bg6xxx


                  Colin, you were right...on the last message, I neglected applicationContext.xml.

                  2nd ATTEMPT w/ applicationContext.xml
                  1. web.xml servlet entry
                  <servlet>
                  <servlet-name>contextLoader</servlet-name>
                  <servlet-class>
                  org.springframework.web.context.ContextLoaderServl et
                  </servlet-class>
                  <load-on-startup>1</load-on-startup>
                  </servlet>

                  <servlet>
                  <servlet-name>tradingapp</servlet-name>
                  <servlet-class>
                  org.springframework.web.servlet.DispatcherServlet
                  </servlet-class>
                  <load-on-startup>1</load-on-startup>
                  </servlet>
                  2. tradingapp-servlet.xml is defined
                  3. applicationContext.xml is defined, with one <beans> entry that refers to a pojo in WEB-INF/classes

                  Results are the same
                  Console(Weblogic 6.1)
                  <21-Nov-04 20:26:50 GMT> <Info> <HTTP> <[WebAppServletContext(2116890,tradingapp,/tradingapp)] Generated java file: C:\Program Files\BEA\wlserver6.1\config\mydomain\applications \tradingapp\WEB-INF\_tmp_war_mydomain_myserver_tradingapp\jsp_s
                  ervlet\__index.java>
                  2004-11-21 20:27:02,687 INFO [org.springframework.web.servlet.view.InternalResou
                  rceViewResolver] - <Cached view 'logon'>

                  Browser:
                  the url is set correctly in the address, but I get a 404 error.
                  For example:
                  1. I typed http://localhost:7001/mydomain
                  2. index.jsp is the welcome file in web.xml. It core:redirects to /logon.htm
                  3. Even though 404 is given in browser page, Address is http://localhost:7001/mydomain/logon.htm

                  I'm open for other suggestions!

                  Thanks

                  Comment

                  Working...
                  X