0 Replies Latest reply on May 8, 2007 2:02 AM by 543715

    ContextLoaderListener problems in preconfigured OC4J 10.1.3.1

    543715
      Hi,

      I've managed to create simple Spring hello world portlet using JDev 10.1.3.2 with preconfigured oc4j 10.1.3.1.1. The preconfigured oc4j is for sure j2EE 1.4 compliant, . I've created the portlet project with Servlet 2.4 and JSP 2.0.

      I ran into trouble with listener classes when deploying to OC4J container. Error is shown below

      <listener>
           <listener-class>
      org.springframework.web.context.ContextLoaderListener
      </listener-class>
      </listener>

      Error:

      07/05/08 11:28:28 oracle.oc4j.admin.internal.DeployerException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
      07/05/08 11:28:28      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:167)
      07/05/08 11:28:28      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      07/05/08 11:28:28      at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1130)
      07/05/08 11:28:28      at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:738)
      07/05/08 11:28:28      at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:414)
      07/05/08 11:28:28      at com.evermind.server.Application.getHttpApplication(Application.java:571)
      07/05/08 11:28:28      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1990)
      07/05/08 11:28:28      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:1909)
      07/05/08 11:28:28      at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1606)
      07/05/08 11:28:28      at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:238)
      07/05/08 11:28:28      at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:99)
      07/05/08 11:28:28      at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:547)
      07/05/08 11:28:28      at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:202)
      07/05/08 11:28:28      at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
      07/05/08 11:28:28      at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
      07/05/08 11:28:28      at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
      07/05/08 11:28:28      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
      07/05/08 11:28:28      at java.lang.Thread.run(Thread.java:595)
      07/05/08 11:28:28 WARNING: ApplicationUnDeployer.removeFiles WARNING: Unable to remove appDir C:\Jdev10.1.3.2\jdev\extensions\oracle.adfp.seededoc4j.10.1.3.2.0\j2ee\home\applications\PortWar : Unable to remove C:\Jdev10.1.3.2\jdev\extensions\oracle.adfp.seededoc4j.10.1.3.2.0\j2ee\home\applications\PortWarjava.io.IOException: Unable to remove C:\Jdev10.1.3.2\jdev\extensions\oracle.adfp.seededoc4j.10.1.3.2.0\j2ee\home\applications\PortWar
           at oracle.oc4j.util.FileUtils.recursiveRemove(FileUtils.java:249)
           at oracle.oc4j.admin.internal.ApplicationUnDeployer.removeFiles(ApplicationUnDeployer.java:146)
           at oracle.oc4j.admin.internal.ApplicationUnDeployer.doUndeploy(ApplicationUnDeployer.java:117)
           at oracle.oc4j.admin.internal.UnDeployerBase.execute(UnDeployerBase.java:91)
           at oracle.oc4j.admin.internal.UnDeployerBase.execute(UnDeployerBase.java:72)
           at oracle.oc4j.admin.internal.ApplicationDeployer.undo(ApplicationDeployer.java:227)
           at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:125)
           at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
           at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)

      07/05/08 11:28:28 WARNING: DeployerRunnable.run Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!oracle.oc4j.admin.internal.DeployerException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
           at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
           at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
           at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)

      So, i changed the listener to servlet as shown below. It worked fine. I don't understand why ContextLoaderListener didn't work and complains as shown above. ContextLoaderServlet is servelt 2.3 and it is deprecated in Servlet 2.4. Has anyone encountered this problem using JDev and Oc4j to create Spring portlet? Is there something wrong with JDev 10.1.3.2 or OC4J 10.1.3.1 when creating Spring portlet? Any help will be greatly appreciated.

      <servlet>
      <servlet-name>context</servlet-name>
      <servlet-class>
      org.springframework.web.context.ContextLoaderServlet
      </servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>