Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was not
deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was not [message #555275] Thu, 26 August 2010 07:43 Go to next message
chrisatpinguin  is currently offline chrisatpinguin
Messages: 18
Registered: May 2010
Junior Member
Hi,

I'm trying to deploy a simple war file into virgo. In my spring config I try to reference an osgi service with
<osgi:reference id="testService" interface="javax.servlet.ServletContext" timeout="1000" />


If i deploy the war file I get
IllegalArgumentException: Required 'bundleContext' property was not set
.

I attached Logfile for more info.

I do not know, what I made wrong. Could someone help me with this?

Thanks
Chris

Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #555444 is a reply to message #555275] Thu, 26 August 2010 15:32 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Depending on how your app is configured:

you might need to include

<context-param>
        <param-name>contextClass</param-name>
        <param-value>org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
    </context-param>



as either context param (as above) or as an init-param to the DispatcherServlet.

You might also be missing imports in your bundle.

If you could provide a bit more information, i.e. web.xml, manifest.mf to start with.

Regards,
Dmitry
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #555454 is a reply to message #555275] Thu, 26 August 2010 16:23 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin
Messages: 18
Registered: May 2010
Junior Member
Hi,

thanks for the info.

I added the entry to the web.xml (global) and add the package to my import in the manifest, but the Virgoserver could not find a bundle exporting the package.

 Resolver report:
        An Import-Package could not be resolved. Caused by missing constraint in bundle <my.company.osgi-webservices_0.0.0>
             constraint: <Import-Package: org.eclipse.virgo.server.web.dm; version="0.0.0">
. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'my.company.osgi-webservices' at version '0.0.0': Cannot resolve: my.company.osgi-webservices
    Resolver report:
        An Import-Package could not be resolved. Caused by missing constraint in bundle <my.company.osgi-webservices_0.0.0>
             constraint: <Import-Package: org.eclipse.virgo.server.web.dm; version="0.0.0">

	at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:45)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessTree(CompensatingPipeline.java:72)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)


So I tried looking for a jar file with an applicable name and I found
./work/org.eclipse.virgo.kernel.deployer_2.1.0.M03-incubation/staging/global/bundle/org.eclipse.virgo.web.dm/2.1.0.M03-incubation/org.eclipse.virgo.web.dm-2.1.0.M03-incubation.jar


Is this package visible for the bundles installed by user? Which package should export the needed package?

here is my web.xml file:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>osgi-webservices</display-name>
  
  <listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
	    			/WEB-INF/applicationContext.xml,
	    			/WEB-INF/osgi-context.xml			
	    </param-value>
	</context-param>
	
	<context-param>
        <param-name>contextClass</param-name>
        <param-value>org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
    </context-param>
	
		
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>    
  </welcome-file-list>
</web-app>


and my Manifest
Manifest-Version: 1.0
Bundle-Vendor: COMPANY AG
Bundle-Version: 0.0.0
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: my.company.osgi-webservices
Bundle-ManifestVersion: 2
Bundle-SymbolicName: my.company.osgi-webservices
Web-ContextPath: wsapi
Import-Package: javax.servlet,javax.
 servlet.http,javax.servlet.resources,org.aopalliance.aop,org.eclipse.
 virgo.server.web.dm,org.springframework.aop,org.springframework.aop.f
 ramework,org.springframework.aop.support,org.springframework.beans.fa
 ctory,org.springframework.beans.factory.config,org.springframework.co
 ntext,org.springframework.osgi.config,org.springframework.remoting.ht
 tpinvoker,org.springframework.remoting.support,org.springframework.ut
 il,org.springframework.web.context,org.springframework.web.context.su
 pport


Thanks for helping out. Perhaps I missed something very easy but its late here in Germany Wink and I play around with virgo for some hours today, it is hard to see anything Smile
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #555463 is a reply to message #555454] Thu, 26 August 2010 16:40 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Sorry,

I copy and pasted from virgo docs but the package for the context is wrong:

it should be

            <param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>



You might also want to add Import-Library for spring. It might be an overkill but a good starting point. You can subtract from there:

Import-Library: org.springframework.spring;version="[3.0, 3.1)"
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #555540 is a reply to message #555275] Fri, 27 August 2010 06:33 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin
Messages: 18
Registered: May 2010
Junior Member
HI Dmitry,

thank you for your help. With the correct import the application and the osgi service reference work fine.

I think I have to read the doc more carefully. Smile

Regards
Chris
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #635219 is a reply to message #555540] Tue, 26 October 2010 03:52 Go to previous messageGo to next message
estrnod is currently offline estrnod
Messages: 12
Registered: October 2010
Junior Member
I am trying to upgrade a war file from dm-server 2.0.0.RELEASE to 2.1.0.RC1-incubation, in prep for the actual Virgo release next week. In 2.0.0, I had this working; in 2.1.0.RC1, I'm having the same problem as above. I have updated the package name for ServerOsgiBundleXmlWebApplicationContext in the web.xml and changed the name and version of the imported bundle to org.eclipse.virgo.web.dm-2.1.0.RC1-incubation.jar. I was (and still am) using Import-Bundle for this bundle rather than Import-Package, and using Import-Library for Spring 3.0.0 in both old & new rather than naming individual packages in Import-Package (which might be a little overkill but from what I understood, it should work.) I have also tried using Import-Package as described above, looking at the current admin app manifest as an example (using its external package imports). Either way, I get the same error.

Is there something else I'm missing?
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #635370 is a reply to message #635219] Tue, 26 October 2010 15:17 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Anything in the logs? Is dump file created? Can you post your manifest.mf?
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #635433 is a reply to message #635370] Tue, 26 October 2010 18:46 Go to previous messageGo to next message
estrnod is currently offline estrnod
Messages: 12
Registered: October 2010
Junior Member
There is no dump created. This is from the log:

2010-10-26 11:34:14.578|start-signalling-3|ERROR|o.s.web.context.Contex tLoader.initWebApplicationContext:208|Context initialization failed org.springframework.context.ApplicationContextException: Failed to load custom context class [org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebAppli cationContext]; nested exception is java.lang.ClassNotFoundException: org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebApplic ationContext
at org.springframework.web.context.ContextLoader.determineConte xtClass(ContextLoader.java:280)
at org.springframework.web.context.ContextLoader.createWebAppli cationContext(ContextLoader.java:233)
at org.springframework.web.context.ContextLoader.initWebApplica tionContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contex tInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(Stand ardContext.java:4182)
at org.apache.catalina.core.StandardContext.start(StandardConte xt.java:4682)
at org.apache.catalina.core.ContainerBase.addChildInternal(Cont ainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBas e.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost. java:546)
at org.eclipse.gemini.web.tomcat.internal.TomcatServletContaine r.startWebApplication(TomcatServletContainer.java:120)
at org.eclipse.gemini.web.internal.StandardWebApplication.start (StandardWebApplication.java:90)
at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListen er.onStarted(WebBundleLifecycleListener.java:120)
at org.eclipse.virgo.kernel.install.artifact.internal.ArtifactS tateMonitor.onStarted(ArtifactStateMonitor.java:205)
at org.eclipse.virgo.kernel.install.artifact.internal.AbstractI nstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.j ava:273)
at org.eclipse.virgo.kernel.install.artifact.internal.AbstractI nstallArtifact.access$0(AbstractInstallArtifact.java:270)
at org.eclipse.virgo.kernel.install.artifact.internal.AbstractI nstallArtifact$StateMonitorSignal.signalSuccessfulCompletion (AbstractInstallArtifact.java:223)
at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1. run(BundleStartTracker.java:140)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebApplic ationContext
at org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappC lassLoader.loadClass(BundleWebappClassLoader.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.springframework.util.ClassUtils.forName(ClassUtils.java: 258)
at org.springframework.web.context.ContextLoader.determineConte xtClass(ContextLoader.java:277)
... 19 common frames omitted



Here is the manifest:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.6.0_16 (Sun Microsystems Inc.)
Built-By: estrnod
Build-Jdk: 1.6.0_16
JDK_VERSION: 1.6
Tool: Bnd-0.0.357
Bundle-Name: HTTP Interface Application Bundle
Import-Library: org.springframework.spring;version="[3.0.0.RELEASE,3.0
 .0.RELEASE]"
Web-ContextPath: ocs
Import-Bundle: com.delphidisplay.insight.common;version="[1.1.0.b,1.1.
 0.b]",org.springframework.security.core;version="[2.0.5.RELEASE,2.0.5
 .RELEASE]",com.springsource.org.apache.commons.codec;version="[1.3.0,
 1.3.0]",org.springframework.osgi.core;version="[1.2.1,1.2.1]",org.ecl
 ipse.virgo.web.dm;version="[2.1.0.RC1-incubation,2.1.0.RC1-incubation
 ]",com.springsource.org.hibernate;version="3.3.2.GA"
Bundle-Version: 1.1.0.b
Bnd-LastModified: 1288117932424
Bundle-ManifestVersion: 2
Import-Package: com.delphidisplay.configuration,com.delphidisplay.pers
 istence.service,com.delphidisplay.security,com.delphidisplay.sockets,
 javax.servlet;version="2.5",javax.servlet.http;version="2.5",org.apac
 he.commons.io;version="1.4",org.apache.commons.lang;version="2.2",org
 .bouncycastle.util.encoders,org.slf4j;version="1.5",org.springframewo
 rk.security;version="2.0",org.springframework.security.context;versio
 n="2.0",org.springframework.web.servlet;version="3.0",org.springframe
 work.web.servlet.mvc;version="3.0"
Bundle-SymbolicName: com.delphidisplay.insight.ocs-http


This manifest is created by Maven using the following plugin configuration:

			<!--  create the manifest -->
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<source>2.0.0</source>
					<target>2.0.0</target>
					<manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
					<supportedProjectTypes>
						<supportedProjectType>jar</supportedProjectType> 
						<supportedProjectType>bundle</supportedProjectType>
						<supportedProjectType>war</supportedProjectType>
					</supportedProjectTypes>
					<instructions>
						<!--
							for MANIFEST.MF to be created by build, it must not already exist
							in source directory
						-->
						<Bundle-Name>HTTP Interface Application Bundle</Bundle-Name>
						<Bundle-SymbolicName>com.delphidisplay.insight.ocs-http</Bundle-SymbolicName>
						<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
						<Import-Package>
 							*;-split-package:=merge-last</Import-Package>
						<Import-Library>org.springframework.spring;version="[${springframework_bundle_version},${springframework_bundle_version}]"</Import-Library>						
						<Import-Bundle>com.delphidisplay.insight.common;version="[${project_version},${project_version}]",org.springframework.security.core;version="[${spring_security_bundle_version},${spring_security_bundle_version}]",com.springsource.org.apache.commons.codec;version="[${apache_commons_codec_bundle_version},${apache_commons_codec_bundle_version}]",org.springframework.osgi.core;version="[${springramework_osgi_core_version},${springramework_osgi_core_version}]",org.eclipse.virgo.web.dm;version="[${dm_server_version},${dm_server_version}]",com.springsource.org.hibernate;version="${hibernate_bundle_version}"</Import-Bundle>
						<Export-Package>!*</Export-Package> 
						<Web-ContextPath>ocs</Web-ContextPath>
					</instructions>
				</configuration>
				<executions>
					<execution>
						<id>bundle-manifest</id>
						<phase>process-classes</phase>
						<goals>
							<goal>manifest</goal>
						</goals>
					</execution>
				</executions>
			</plugin>


Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #635436 is a reply to message #635433] Tue, 26 October 2010 18:58 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Change
org.eclipse.virgo.server.web.dm.ServerOsgiBundleXmlWebApplicationContext


to

org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext
Re: deploying simple war file causes IllegalArgumentException: Required 'bundleContext' property was [message #635463 is a reply to message #635436] Tue, 26 October 2010 22:24 Go to previous message
estrnod is currently offline estrnod
Messages: 12
Registered: October 2010
Junior Member
That solved my problem - thank you very much!

It looks like the Virgo Programmer Guide needs a slight update - that is where I got the new package name from (but I should have caught it looking in the jar.) Thanks again!
Previous Topic:How to configure embedded Tomcat?
Next Topic:@PostConstruct method is not invoked
Goto Forum:
  


Current Time: Tue Sep 16 21:40:56 GMT 2014

Powered by FUDForum. Page generated in 0.03321 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software