These are 'good' errors  :)

They mean that you are attempting to load a bundle, but the bundle needs 
(requires) some packages that are not available. 

For example:

ERROR: Bundle org.apache.felix.webconsole [1] Error starting 
jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.webconsole-4.2.0-all.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.webconsole [1]: Unable to resolve 1.0: missing requirement 
[1.0] osgi.wiring.package;
(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0))))

This message means that you are trying to start bundle

org.apache.felix.webconsole-4.2.0-all.jar

but it is missing some dependencies. If we read the docs here:
http://felix.apache.org/site/apache-felix-web-console.html
we find that it needs 'a running implementation of the OSGi Http Service 
Specification.'. The docs list some suggestions:

Apache Felix HTTP Service. 
PAX Web Service. 
Equinox HTTP Service implementation.

So you will have to find one of those bundles and make sure it is deployed as 
well.

The 'good' thing about these errors is that Felix' dependency mechanism is 
working as expected. It is refusing to start a bundle for which it cannot 
satisfy all the required dependencies. This in contrast to NoClassDefFound / 
ClassNotFound errors, which are runtime errors indicating that you did 
something wrong so Felix could not protect you against trying to load classes 
that are not available.

So, check out all these errors. Look where the packages mentioned in the error 
messages are supposed to be coming from. More often than not these are supposed 
to be coming from some other bundle. Then just make sure to deploy that bundle 
as well and the error should be solved.

E.G in the previous error message, the text

        
(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0))))

indicates that the package org.osgi.service.http is needed (and version should 
be greater or equal to 1.2.0 and not greater or equal to 2.0.0).

Good luck!

-Stijn



-----Original Message-----
From: Arpan Mukhopadhyay [mailto:[email protected]] 
Sent: maandag 30 december 2013 9:50
To: [email protected]
Subject: Re: Unable to call osgi bundles from Servlet

Nope, in fact I am having a different issue now while starting the felix 
embeded in tomcat.

Here is the details exception

Dec 30, 2013 11:52:53 AM org.apache.catalina.core.
AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal 
performance in production environments was not found on the
java.library.path:
D:\installedsoftwares\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/installedsoftwares/Java/jre7/bin/client;D:/installedsoftwares/Java/jre7/bin;D:/installedsoftwares/Java/jre7/lib/i386;C:\Program
Files\PC Connectivity Solution\;C:\Program Files\Common Files\Microsoft 
Shared\Windows 
Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\Intel\DMIX;C:\Program
Files\WinMerge;C:\Python27;D:\Jagadeesh\Venturi_VVO\Installers\;C:\ffmpeg\bin;D:\installedsoftwares\Java\jdk1.7.0_25\bin;D:\installedsoftwares\SlikSvn\bin;D:\installedsoftwares\TortoiseSVN\bin;D:\installedsoftwares\mongodb\bin;D:\installedsoftwares\apachemaven\bin;D:\installedsoftwares\apache-ant-1.7.1\bin;D:\installedsoftwares\nodejs\;D:\other-downloads\spring-roo-1.2.5.BUILD-SNAPSHOT\bin;D:\installedsoftwares\jetty\bin;D:\Program
Files\SQL Anywhere
16\bin32;D:\installedsoftwares\gradle-1.9\bin;D:\installedsoftwares\groovy-2.2.1\bin;C:\Documents
and Settings\arpan\Application Data\npm;C:\Program 
Files\CrSSL\bin;D:\installedsoftwares\eclipse;;.
Dec 30, 2013 11:52:53 AM org.apache.tomcat.util.digester.SetPropertiesRule
begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting 
property 'source' to 'org.eclipse.jst.jee.server:osgi-demo' did not find a 
matching property.
Dec 30, 2013 11:52:54 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"] Dec 30, 2013 11:52:54 AM 
org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Dec 30, 2013 11:52:54 AM 
org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 384 ms Dec 30, 2013 11:52:54 AM 
org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Dec 30, 2013 11:52:54 AM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Dec 30, 2013 11:52:54 AM 
org.apache.catalina.core.ApplicationContext log
INFO: Installing bundle
[jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.webconsole-4.2.0-all.jar]
Dec 30, 2013 11:52:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Installing bundle
[jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.shell-0.10.0.jar]
Dec 30, 2013 11:52:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Installing bundle
[jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.command-0.12.0.jar]
Dec 30, 2013 11:52:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Installing bundle
[jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.bundlerepository-1.6.6.jar]
Dec 30, 2013 11:52:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Installing bundle
[jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.runtime-0.10.0.jar]
ERROR: Bundle org.apache.felix.webconsole [1] Error starting 
jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.webconsole-4.2.0-all.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.webconsole [1]: Unable to resolve 1.0: missing requirement 
[1.0] osgi.wiring.package;
(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.webconsole [1]: Unable to resolve 1.0: missing requirement 
[1.0] osgi.wiring.package;
(&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.0)(!(version>=2.0.0)))
    at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
    at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
    at java.lang.Thread.run(Unknown Source)
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.shell [2]: Unable to resolve 2.0: missing requirement 
[2.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.service.command)(status=provisional)(version>=0.10.0))
[caused by: Unable to resolve 5.0: missing requirement [5.0] 
osgi.wiring.package; (osgi.wiring.package=org.osgi.util.tracker)]
    at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
    at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
    at java.lang.Thread.run(Unknown Source)
ERROR: Bundle org.apache.felix.gogo.shell [2] Error starting 
jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.shell-0.10.0.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.shell [2]: Unable to resolve 2.0: missing requirement 
[2.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.service.command)(status=provisional)(version>=0.10.0))
[caused by: Unable to resolve 5.0: missing requirement [5.0] 
osgi.wiring.package; (osgi.wiring.package=org.osgi.util.tracker)])
ERROR: Bundle org.apache.felix.gogo.command [3] Error starting 
jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.command-0.12.0.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.command [3]: Unable to resolve 3.0: missing requirement 
[3.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.service.command)(status=provisional)(version>=0.10.0)(!(version>=1.0.0)))
[caused by: Unable to resolve 5.0: missing requirement [5.0] 
osgi.wiring.package; (osgi.wiring.package=org.osgi.util.tracker)])
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.command [3]: Unable to resolve 3.0: missing requirement 
[3.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.service.command)(status=provisional)(version>=0.10.0)(!(version>=1.0.0)))
[caused by: Unable to resolve 5.0: missing requirement [5.0] 
osgi.wiring.package; (osgi.wiring.package=org.osgi.util.tracker)]
    at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
    at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
    at java.lang.Thread.run(Unknown Source)
ERROR: Bundle org.apache.felix.gogo.runtime [5] Error starting 
jndi:/localhost/osgi-demo/WEB-INF/bundles/org.apache.felix.gogo.runtime-0.10.0.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.runtime [5]: Unable to resolve 5.0: missing requirement 
[5.0] osgi.wiring.package;
(osgi.wiring.package=org.osgi.util.tracker))
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.gogo.runtime [5]: Unable to resolve 5.0: missing requirement 
[5.0] osgi.wiring.package;
(osgi.wiring.package=org.osgi.util.tracker)
    at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
    at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
    at java.lang.Thread.run(Unknown Source) Dec 30, 2013 11:52:54 AM 
org.apache.catalina.core.ApplicationContext log
SEVERE: OSGi framework started
Dec 30, 2013 11:52:54 AM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory 
D:\installedsoftwares\apache-tomcat-7.0.47\webapps\docs
Dec 30, 2013 11:52:55 AM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory 
D:\installedsoftwares\apache-tomcat-7.0.47\webapps\examples
Dec 30, 2013 11:52:55 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized() Dec 30, 2013 11:52:55 AM 
org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized() Dec 30, 2013 11:52:55 AM 
org.apache.catalina.core.ApplicationContext log
INFO: ContextListener:
attributeAdded('org.apache.jasper.compiler.TldLocationsCache',
'org.apache.jasper.compiler.TldLocationsCache@133bf6d')
Dec 30, 2013 11:52:55 AM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory 
D:\installedsoftwares\apache-tomcat-7.0.47\webapps\host-manager
Dec 30, 2013 11:52:55 AM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory 
D:\installedsoftwares\apache-tomcat-7.0.47\webapps\manager
Dec 30, 2013 11:52:55 AM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory 
D:\installedsoftwares\apache-tomcat-7.0.47\webapps\ROOT
Dec 30, 2013 11:52:55 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"] Dec 30, 2013 11:52:55 AM 
org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"] Dec 30, 2013 11:52:55 AM 
org.apache.catalina.startup.Catalina start
INFO: Server startup in 1391 ms


I took the example from
http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#using-the-servlet-bridge

All jars are downloaded from http://felix.apache.org/downloads.cgi


jars inside /WEB-INF/lib is listed below

felix.jar
org.apache.felix.http.proxy-2.2.2.jar

and the bundles are inside /WEB-INF/bundles and the list is below

org.apache.felix.bundlerepository-1.6.6.jar
org.apache.felix.gogo.command-0.12.0.jar
org.apache.felix.gogo.runtime-0.10.0.jar
org.apache.felix.gogo.shell-0.10.0.jar
org.apache.felix.webconsole-4.2.0-all.jar


Thanks
Arpan




On Mon, Dec 30, 2013 at 1:50 PM, ajinkya prabhune < [email protected]> 
wrote:

> Hi Arpan,
>
> Were you able to solve the problem ?
>
>
>
> On Fri, Dec 27, 2013 at 6:29 AM, ajinkya prabhune < 
> [email protected]> wrote:
>
> > Hi Arpan,
> >
> > I am not sure what your use case is exactly, but would suggest you 
> > to use "osgi-bundlecontext" from your web application bundle (wab) 
> > and access
> the
> > osgi bundle which you have created in step1
> >
> > Regards
> > Ajinkya
> >
> > On Friday, December 27, 2013, Arpan Mukhopadhyay wrote:
> >
> >> I have two projects.
> >>
> >>    1. An osgi bundle (eclipse plugin project).
> >>    2. A simple web application (deployable in tomcat).
> >>
> >> I have started the felix container from tomcat with no problem by 
> >> following the link below
> >>
> >>
> >>
> http://felix.apache.org/documentation/subprojects/apache-felix-http-se
> rvice.html#using-the-servlet-bridge
> >>
> >> Now I am stuck how to call the classes of the bundle (already 
> >> installed
> in
> >> the felix container) from a servlet. It is throwing class not found
> error
> >> as the bundle project is not in the classpath but in the following 
> >> location /WEB-IN/bundles.(I have to use this location for the 
> >> bundles). So how it could be achieved ?
> >>
> >> Thanks
> >>
> >> Arpan
> >>
> >
> >
> > --
> > Thank you and Regards
> > Ajinkya Prabhune
> >
> >
>
>
> --
> Thank you and Regards
> Ajinkya Prabhune
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to