Results 1 to 8 of 8

Thread: Cannot create WebApplication context

  1. #1
    Join Date
    Mar 2010
    Posts
    16

    Default Cannot create WebApplication context

    Greetings,

    I have created a sample spring-dm powered web application, which currently does nothing but displaying some static content (servicing a couple of static HTML pages).

    After enabling spring-dm osgi context support in web.xml (as described in docs section 9.7 with OsgiBundleXmlWebApplicationContext etc)

    I unexpectedly started getting the following error

    [2010-03-29 01:28:21.708] start-signalling-1 org.springframework.web.context.ContextLoader Context initialization failed java.lang.IllegalArgumentException: bundle context should be set before refreshing the application context
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.normalRefresh( AbstractDelegatedExecutionApplicationContext.java: 179)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext$NoDependencies WaitRefreshExecutor.refresh(AbstractDelegatedExecu tionApplicationContext.java:89)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.refresh(Abstra ctDelegatedExecutionApplicationContext.java:175)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:261)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:192)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3983)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4483)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:526)
    at com.springsource.osgi.webcontainer.tomcat.internal .TomcatServletContainer.startWebApplication(Tomcat ServletContainer.java:119)
    at com.springsource.osgi.webcontainer.internal.Standa rdWebContainer$StandardWebApplication.start(Standa rdWebContainer.java:116)
    at com.springsource.server.web.core.internal.WebBundl eLifecycleListener.onStarted(WebBundleLifecycleLis tener.java:130)
    at com.springsource.kernel.install.artifact.internal. ArtifactStateMonitor.onStarted(ArtifactStateMonito r.java:215)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.asyncStartSucceeded(Abstra ctInstallArtifact.java:281)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.access$0(AbstractInstallAr tifact.java:278)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact$StateMonitorSignal.signalS uccessfulCompletion(AbstractInstallArtifact.java:2 31)
    at com.springsource.kernel.core.internal.BundleStartT racker$1.run(BundleStartTracker.java:150)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    [2010-03-29 01:28:21.716] start-signalling-1 o.a.catalina.core.ContainerBase.[Catalina].[localhost].[/sample] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner java.lang.IllegalArgumentException: bundle context should be set before refreshing the application context
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.normalRefresh( AbstractDelegatedExecutionApplicationContext.java: 179)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext$NoDependencies WaitRefreshExecutor.refresh(AbstractDelegatedExecu tionApplicationContext.java:89)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.refresh(Abstra ctDelegatedExecutionApplicationContext.java:175)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:261)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:192)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3983)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4483)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:526)
    at com.springsource.osgi.webcontainer.tomcat.internal .TomcatServletContainer.startWebApplication(Tomcat ServletContainer.java:119)
    at com.springsource.osgi.webcontainer.internal.Standa rdWebContainer$StandardWebApplication.start(Standa rdWebContainer.java:116)
    at com.springsource.server.web.core.internal.WebBundl eLifecycleListener.onStarted(WebBundleLifecycleLis tener.java:130)
    at com.springsource.kernel.install.artifact.internal. ArtifactStateMonitor.onStarted(ArtifactStateMonito r.java:215)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.asyncStartSucceeded(Abstra ctInstallArtifact.java:281)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.access$0(AbstractInstallAr tifact.java:278)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact$StateMonitorSignal.signalS uccessfulCompletion(AbstractInstallArtifact.java:2 31)
    at com.springsource.kernel.core.internal.BundleStartT racker$1.run(BundleStartTracker.java:150)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    [2010-03-29 01:28:21.716] start-signalling-1 org.apache.catalina.core.StandardContext Error listenerStart
    [2010-03-29 01:28:21.716] start-signalling-1 org.apache.catalina.core.StandardContext Context [/sample] startup failed due to previous errors
    [2010-03-29 01:28:21.738] start-signalling-1 com.springsource.osgi.webcontainer.internal.Standa rdWebContainer Failed to start web application at context path '/sample' com.springsource.osgi.webcontainer.core.spi.Servle tContainerException: Web application at '/sample' failed to start. Check the logs for more details.
    at com.springsource.osgi.webcontainer.tomcat.internal .TomcatServletContainer.startWebApplication(Tomcat ServletContainer.java:122)
    at com.springsource.osgi.webcontainer.internal.Standa rdWebContainer$StandardWebApplication.start(Standa rdWebContainer.java:116)
    at com.springsource.server.web.core.internal.WebBundl eLifecycleListener.onStarted(WebBundleLifecycleLis tener.java:130)
    at com.springsource.kernel.install.artifact.internal. ArtifactStateMonitor.onStarted(ArtifactStateMonito r.java:215)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.asyncStartSucceeded(Abstra ctInstallArtifact.java:281)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact.access$0(AbstractInstallAr tifact.java:278)
    at com.springsource.kernel.install.artifact.internal. AbstractInstallArtifact$StateMonitorSignal.signalS uccessfulCompletion(AbstractInstallArtifact.java:2 31)
    at com.springsource.kernel.core.internal.BundleStartT racker$1.run(BundleStartTracker.java:150)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    ... some more exception info (less important) follow, about bundle failed to start and bundle stopping etc. but could not fit in post ...

    No idea where this came from.
    "bundle context should be set before refreshing the application context"?
    I was hoping that the web extender is responsible for this, which by the way is installed and active (version 1.2.1, compatible, not initially existed, manually added as recommended in docs) in the dm-server 2.0.0 instance I tried to deploy the sample webapp.

    Any ideas?

  2. #2
    Join Date
    Mar 2010
    Posts
    16

    Default Correction

    Correction, web extender is NOT running.

    I missed this output when I first installed web extender

    [2010-03-29 05:03:31.243] start-signalling-4 com.springsource.osgi.medic.eventlog.default DE0005I Started bundle 'org.springframework.osgi.web.extender' version '1.2.1'.
    [2010-03-29 05:03:36.257] WebExtender-Init org.springframework.osgi.web.deployer.tomcat.Tomca tWarDeployer No Catalina Service found, bailing out org.springframework.osgi.service.ServiceUnavailabl eException: service matching filter=[(objectClass=org.apache.catalina.Service)] unavailable
    at org.springframework.osgi.service.importer.support. internal.aop.ServiceDynamicInterceptor.getTarget(S erviceDynamicInterceptor.java:419)
    at org.springframework.osgi.service.importer.support. internal.aop.ServiceDynamicInterceptor.afterProper tiesSet(ServiceDynamicInterceptor.java:472)
    at org.springframework.osgi.service.importer.support. OsgiServiceProxyFactoryBean.createProxy(OsgiServic eProxyFactoryBean.java:215)
    at org.springframework.osgi.service.importer.support. AbstractServiceImporterProxyFactoryBean.getObject( AbstractServiceImporterProxyFactoryBean.java:86)
    at org.springframework.osgi.service.importer.support. OsgiServiceProxyFactoryBean.getObject(OsgiServiceP roxyFactoryBean.java:161)
    at org.springframework.osgi.web.deployer.internal.uti l.Utils.createServerServiceProxy(Utils.java:121)
    at org.springframework.osgi.web.deployer.tomcat.Tomca tWarDeployer.afterPropertiesSet(TomcatWarDeployer. java:90)
    at org.springframework.osgi.web.extender.internal.act ivator.WarListenerConfiguration.createDefaultWarDe ployer(WarListenerConfiguration.java:197)
    at org.springframework.osgi.web.extender.internal.act ivator.WarListenerConfiguration.<init>(WarListener Configuration.java:105)
    at org.springframework.osgi.web.extender.internal.act ivator.WarLoaderListener$1.run(WarLoaderListener.j ava:361)
    at java.lang.Thread.run(Unknown Source)

    [2010-03-29 05:03:36.260] WebExtender-Init o.s.osgi.web.extender.internal.activator.WarLoader Listener Cannot property start Spring DM WebExtender; stopping bundle... org.springframework.osgi.OsgiException: Cannot create Tomcat deployer
    at org.springframework.osgi.web.extender.internal.act ivator.WarListenerConfiguration.createDefaultWarDe ployer(WarListenerConfiguration.java:201)
    at org.springframework.osgi.web.extender.internal.act ivator.WarListenerConfiguration.<init>(WarListener Configuration.java:105)
    at org.springframework.osgi.web.extender.internal.act ivator.WarLoaderListener$1.run(WarLoaderListener.j ava:361)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.osgi.service.ServiceUnavailabl eException: service matching filter=[(objectClass=org.apache.catalina.Service)] unavailable
    at org.springframework.osgi.service.importer.support. internal.aop.ServiceDynamicInterceptor.getTarget(S erviceDynamicInterceptor.java:419)
    at org.springframework.osgi.service.importer.support. internal.aop.ServiceDynamicInterceptor.afterProper tiesSet(ServiceDynamicInterceptor.java:472)
    at org.springframework.osgi.service.importer.support. OsgiServiceProxyFactoryBean.createProxy(OsgiServic eProxyFactoryBean.java:215)
    at org.springframework.osgi.service.importer.support. AbstractServiceImporterProxyFactoryBean.getObject( AbstractServiceImporterProxyFactoryBean.java:86)
    at org.springframework.osgi.service.importer.support. OsgiServiceProxyFactoryBean.getObject(OsgiServiceP roxyFactoryBean.java:161)
    at org.springframework.osgi.web.deployer.internal.uti l.Utils.createServerServiceProxy(Utils.java:121)
    at org.springframework.osgi.web.deployer.tomcat.Tomca tWarDeployer.afterPropertiesSet(TomcatWarDeployer. java:90)
    at org.springframework.osgi.web.extender.internal.act ivator.WarListenerConfiguration.createDefaultWarDe ployer(WarListenerConfiguration.java:197)
    ... 3 common frames omitted

    [2010-03-29 05:03:36.265] WebExtender-Init com.springsource.osgi.medic.eventlog.default DE0010I Stopping bundle 'org.springframework.osgi.web.extender' version '1.2.1'.
    [2010-03-29 05:03:36.272] WebExtender-Init com.springsource.osgi.medic.eventlog.default DE0011I Stopped bundle 'org.springframework.osgi.web.extender' version '1.2.1'.

    It is obvious that without web extender my webapp will never get a chance to properly start.

    Any ideas why web extender is not starting?

    I was expecting that Tomcat deployer is by default installed and active. Exception log above shows otherwise.

    Still, service of class org.apache.catalina.Service was not found running in DM-Server instance. Makes sense.

    Perhaps I have to provide a related fragment. But again I was expecting such a fragment already existing.

    Or perhaps not. Hmmm, from another point of view it is not necessary, depends on application container requirements what to start and what not to.
    Suspecting there is a reason tomcat is not started by default.
    Investigating..........

  3. #3
    Join Date
    Mar 2010
    Posts
    16

    Default What is wrong?

    Web Extender still fails to start although the Tomcat starter bundle catalina.start.osgi is properly deployed and started
    (after changing its configuration .xml to resolve HTTP port conflict on default port 8080)

    Any ideas?

  4. #4

    Default

    same problem here with Spring DM 1.1.2 as well

    It seems the issue was fixed:
    http://jira.springframework.org/browse/OSGI-595

    but apparently it's still occuring, at least with 1.1.2 version.

    Isn't Jetty supposed to work better ?

  5. #5

    Default

    After 2 painful hours of digging, I just repackaged catalina.start.osgi-1.0.0.jar changing default port to be 8090 but then Catalina still starts on port 8080 !?

  6. #6
    Join Date
    Mar 2010
    Posts
    16

    Default

    Well, this JIRA issue suggests the start order is a quick and dirty solution.
    So far so good. I will try this......

    Still, catalina.osgi.start bundle (after repackaging it changing conf/default-server.xml) is not starting (did not observe related output on log file, as on JIRA posted issue)

    In another article on this forum I read (I will post once found again) it is recommended to deploy a fragment of "catalina" bundles providing some additional tomcat xml files (context.xml, web.xml etc.)

    I will post both the related article and the solution if it works for me.

    Perhaps a look or even modification at catalina.osgi.start source code...........

    On the other hand, Jetty could be a working alternative.
    Providing Web Extender configuration with Jetty deployer instead of the default Tomcat should work provided that Jetty can be properly started.
    Good idea, will try that too......

  7. #7

    Default

    Ok, I got it working with Spring DM 1.2.1 and Jetty

    here is the list of dependencies

    <!-- Jetty dependencies -->
    <dependency>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>com.springsource.org.mortbay.jetty.ser ver</artifactId>
    <version>6.1.9</version>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>com.springsource.org.mortbay.util</artifactId>
    <version>6.1.9</version>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>com.springsource.javax.servlet</artifactId>
    <version>2.5.0</version>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>org.springframework.osgi</groupId>
    <artifactId>jetty.start.osgi</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>org.springframework.osgi</groupId>
    <artifactId>jetty.web.extender.fragment.osgi</artifactId>
    <version>1.0.1</version>
    <scope>test</scope>
    </dependency>


    But I failed to change the default 8080 port so i had to ensure it was free at first

  8. #8
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Guys, not sure if you're using the same setup but the first post indicates dmServer is used.
    As for Spring DM and the web support have you tried the web samples?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •