Ultimately, I am at a loss to explain what is going on...

Perhaps, you could package the minimal set of pieces to reproduce the issue and I can try to look at it locally. Basically, I would need your launcher source with any necessary bundles to install and start.

Send it to me off list.

-> richard

Sameera Withanage wrote:
Today I took the latest of Felix and Spring-OSGi and built.

WARNING: META-INF/services/org.apache.commons.logging.LogFactory (
org.apache.felix.moduleloader.ResourceNotFoundException:
META-INF/services/org.apache.commons.logging.LogFactory)
WARNING: *** Class 'org.apache.commons.logging.impl.Log4JLogger' was not
found. Bundle 32 does not import package 'org.apache.commons.logging.impl', nor is the package exported by any other bundle or available from the system
class loader. *** (java.lang.ClassNotFoundException: *** Class '
org.apache.commons.logging.impl.Log4JLogger' was not found. Bundle 32 does
not import package 'org.apache.commons.logging.impl', nor is the package
exported by any other bundle or available from the system class loader. ***)

org.osgi.framework.BundleException:
org.apache.commons.logging.impl.Log4JLogger
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1184)
       at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java
:337)
       at
org.springframework.osgi.context.support.BundleDelegatingClassLoader.findClass
(BundleDelegatingClassLoader.java:108)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at
org.springframework.osgi.context.support.BundleDelegatingClassLoader.loadClass
(BundleDelegatingClassLoader.java:389)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass
(LogFactoryImpl.java:1005)
       at
org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(
LogFactoryImpl.java:838)
       at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:601)
       at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:333)
       at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:307)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
       at org.springframework.context.support.AbstractApplicationContext
.<init>(AbstractApplicationContext.java:134)
       at
org.springframework.context.support.AbstractRefreshableApplicationContext
.<init>(AbstractRefreshableApplicationContext.java:80)
       at
org.springframework.osgi.context.support.AbstractRefreshableOsgiBundleApplicationContext
.<init>(AbstractRefreshableOsgiBundleApplicationContext.java:115)
       at
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext
.<init>(OsgiBundleXmlApplicationContext.java:57)
       at
org.springframework.osgi.extender.support.ServiceDependentOsgiBundleXmlApplicationContext
.<init>(ServiceDependentOsgiBundleXmlApplicationContext.java:56)
       at
org.springframework.osgi.extender.support.ApplicationContextCreator.createApplicationContext
(ApplicationContextCreator.java:196)
       at
org.springframework.osgi.extender.support.ApplicationContextCreator.run(
ApplicationContextCreator.java:140)
       at java.lang.Thread.run(Thread.java:595)

I'm getting this error when starting my bundle. I noticed through console
that the extender service and all the spring modules are available. But the
former gives list of these warnings

WARNING: META-INF/spring.handlers (
org.apache.felix.moduleloader.ResourceNotFoundException:
META-INF/spring.handlers)
WARNING: META-INF/spring.schemas (
org.apache.felix.moduleloader.ResourceNotFoundException:
META-INF/spring.schemas)
WARNING: META-INF/spring/extender.xml (
org.apache.felix.moduleloader.ResourceNotFoundException:
META-INF/spring/extender.xml)

Thank you.

Sameera

On 4/26/07, Richard S. Hall <[EMAIL PROTECTED]> wrote:

Sameera Withanage wrote:
> Firstly thank you for all the help.
>
> I checked out the latest code and able to run it without that
> numberformat
> exception. I think I've done something wrong.
>
> But the spring service registration issue is still there. When I
launched
> Felix from command line I can see the registered services of my sample
> spring bundle, but in embedded application it still returns null for
> services[].

Which version of Felix and Spring-OSGi are you using?

There was an issue where Spring-OSGi was making assumptions about the
URL format being returned for bundle resources which was causing it to
not correctly discover the Spring resource tiles, which ultimately led
to it not creating Spring components/services, etc.

Perhaps this is what you are seeing, but I thought it was fixed now.

-> richard

>
> Sameera
>
>
>
> On 4/26/07, Sameera Withanage <[EMAIL PROTECTED]> wrote:
>>
>> This is the host application....
>>
>> import java.io.IOException;
>> import java.util.ArrayList;
>> import java.util.List;
>> import java.util.Map;
>> import java.util.Properties;
>>
>> import org.apache.felix.framework.Felix ;
>> import org.apache.felix.framework.cache.BundleCache;
>> import org.apache.felix.framework.util.MutablePropertyResolver;
>> import org.apache.felix.framework.util.MutablePropertyResolverImpl;
>> import org.apache.felix.framework.util.StringMap ;
>> import org.osgi.framework.Bundle;
>> import org.osgi.framework.BundleActivator;
>> import org.osgi.framework.BundleContext;
>> import org.osgi.framework.Constants;
>> import org.osgi.util.tracker.ServiceTracker;
>> import org.springframework.osgi.samples.simpleservice.MyService;
>>
>> public class FelixHost {
>>     private HostActivator m_activator = null;
>>
>>     private Felix m_felix = null;
>>
>>     private ServiceTracker m_tracker = null;
>>
>>     public FelixHost() {
>>         Map configMap = new StringMap(false);
>>
>>         Properties p = new Properties();
>>         try {
>>             p.load(this.getClass
().getClassLoader().getResourceAsStream(
>>                     "roland.properties"));
>>         } catch (IOException e) {
>>             e.printStackTrace();
>>         }
>>
>>         p.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
>>                 " org.osgi.framework; version=1.3.0,"
>>                         + "org.osgi.service.packageadmin;
>> version=1.2.0,"
>> + "org.osgi.service.startlevel; version=1.0.0,"
>>                         + " org.osgi.service.url; version=1.0.0,"
>>                         +
>> "org.springframework.osgi.samples.simpleservice
>> ;");
>>         p.put(BundleCache.CACHE_PROFILE_DIR_PROP,
>> "/home/sameera/.felix/new1");
>>
>>         try {
>>             m_felix = new Felix();
>>
>>             m_activator = new HostActivator();
>>             List<BundleActivator> act = new ArrayList();
>>             act.add(m_activator);
>>
>>             MutablePropertyResolver resolver = new
>> MutablePropertyResolverImpl(
>>                     p);
>>             m_felix.start(resolver, act);
>>             System.out.println("Felix started.");
>>         } catch (Exception ex) {
>>             System.err.println("Could not create framework: " + ex);
>>             ex.printStackTrace();
>>         }
>>
>>         m_tracker = new ServiceTracker(m_activator.getContext(),
>>                 MyService.class.getName(), null);
>>         m_tracker.open();
>>     }
>>
>>     public String callService() {
>>         Object[] services = m_tracker.getServices();
>>         System.out.println("sevices length :" + services.length);
>>         for (int i = 0; (services != null) && (i < services.length);
>> i++)
>> {
>>             try {
>>                 return ((MyService) services[i]).stringValue();
>>
>>             } catch (Exception ex) {
>>                 System.out.println(ex);
>>             }
>>         }
>>         return "):";
>>     }
>>
>>     public Bundle[] getInstalledBundles() {
>>         return m_activator.getContext().getBundles();
>>     }
>>
>>     public BundleContext getContext() {
>>         return m_activator.getContext();
>>     }
>>
>>     public void shutdownApplication() {
>>         System.out.println("Shutting down Felix.");
>>         m_felix.shutdown();
>>     }
>>
>> }
>>
>> and from another class ....
>>
>> FelixHost host = new FelixHost();
>> BundleContext context = host.getContext();
>> Bundle bundle = context.installBundle("file:/work/bundle.jar");
>> bundle.start();
>>
>> Additionally the activator ...
>>
>> import org.osgi.framework.BundleActivator;
>> import org.osgi.framework.BundleContext;
>>
>> public class HostActivator implements BundleActivator
>> {
>>     private BundleContext m_context = null;
>>
>>     public void start(BundleContext context)
>>     {
>>         m_context = context;
>>     }
>>
>>     public void stop(BundleContext context)
>>     {
>>         m_context = null;
>>     }
>>
>>     public BundleContext getContext()
>>     {
>>         return m_context;
>>     }
>> }
>>
>>
>> Thank you.
>>
>> Sameera
>>
>>
>>
>>
>> On 4/25/07, Richard S. Hall <[EMAIL PROTECTED]> wrote:
>> >
>> > I cannot see what is going wrong...it definitely appears to be
>> getting a
>> > different manifest file, because the bundle version number giving
>> you an
>> > exception is ${pom...} rather than a real version.
>> >
>> > Perhaps you should let us see your code for launching Felix and
>> > installing the bundle.
>> >
>> > -> richard
>> >
>> > Sameera Withanage wrote:
>> > > I checked all the manifest entries in all jar files and found no
>> > entries.
>> > > But the entries I found were in pom.xml.
>> > >
>> > > I think something wrong the way I launched Felix, because
standalone
>> > is
>> > > working fine.
>> > >
>> > > I'm loading bundle from a jar. It is from the simple-service-bundle
>> > > sample
>> > > comes with spring-osgi.
>> > >
>> > > -----Bundle Content---
>> > >
>> > >     META-INF/
>> > >     META-INF/MANIFEST.MF
>> > >     META-INF/spring/
>> > >     META-INF/spring/simpleservice-osgi.xml
>> > >     META-INF/spring/simpleservice.xml
>> > >     META-INF/maven/
>> > >     META-INF/maven/org.springframework.osgi.samples/
>> > >
>> > >
>> META-INF/maven/org.springframework.osgi.samples/simple-service-bundle/
>> > >
>> > >
>> >
>>
META-INF/maven/org.springframework.osgi.samples/simple-service-bundle/pom.xml
>>
>> >
>> > >
>> > >
>> > >
>> >
>>
META-INF/maven/org.springframework.osgi.samples/simple-service-bundle/pom.properties
>>
>> > >
>> > >     org/
>> > >     org/springframework/
>> > >     org/springframework/osgi/
>> > >     org/springframework/osgi/samples/
>> > >     org/springframework/osgi/samples/simpleservice/
>> > >     org/springframework/osgi/samples/simpleservice/impl/
>> > >
>> > >
>> >
>> org/springframework/osgi/samples/simpleservice/impl/MyServiceImpl.class >> > > org/springframework/osgi/samples/simpleservice/MyService.class
>> > >
>> > > -----Manifest file----
>> > >
>> > > Manifest-Version: 1.0
>> > > Archiver-Version: Plexus Archiver
>> > > Created-By: Apache Maven
>> > > Built-By: sameera
>> > > Build-Jdk: 1.5.0_09
>> > > Extension-Name: simple-service-bundle
>> > > Specification-Title: The Spring-OSGi project makes it easy to
>> build Sp
>> > > ring applications
>> > >  that run in an OSGi framework. A Spring applicati
>> > > on written in this
>> > >  way provides better separation of modules, the a
>> > > bility to
>> > >  dynamically add, remove, and update modules in a running
>> > > system, the
>> > >  ability to deploy multiple versions of a module simulta
>> > > neously (and
>> > >  have clients automatically bind to the appropriate one
>> > > ), and a dynamic
>> > >  service model.
>> > > Specification-Vendor: Spring Framework
>> > > Implementation-Vendor: Spring Framework
>> > > Implementation-Title: simple-service-bundle
>> > > Implementation-Version: 1.0-m1
>> > > Bundle-Version: 1.0
>> > > Bundle-Vendor: Spring Framework
>> > > Bundle-DocURL: http://www.springframework.org/osgi
>> > > Bundle-ClassPath: .,target/classes/
>> > > Bundle-SymbolicName: org.springframework.osgi.samples.simpleservice
>> > > Bundle-Name: Simple-Service-Sample
>> > > Export-Package: org.springframework.osgi.samples.simpleservice
>> > >
>> > > ----Simpleservice.xml ---
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > <beans xmlns="http://www.springframework.org/schema/beans";
>> > >  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance";
>> > >  xsi:schemaLocation="http://www.springframework.org/schema/beans
>> > > http://www.springframework.org/schema/beans/spring-beans.xsd";>
>> > >
>> > >  <bean name="simpleService" class="
>> > >
>> org.springframework.osgi.samples.simpleservice.impl.MyServiceImpl" />
>> > >
>> > > </beans>
>> > >
>> > > ----Simpleservice-OSGi.xml ---
>> > >
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > <beans xmlns="http://www.springframework.org/schema/beans";
>> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
>> > >  xmlns:osgi="http://www.springframework.org/schema/osgi";
>> > >  xsi:schemaLocation=" http://www.springframework.org/schema/beans
>> > > http://www.springframework.org/schema/beans/spring-beans.xsd
>> > >                       http://www.springframework.org/schema/osgi
>> > > http://www.springframework.org/schema/osgi/spring-osgi.xsd ">
>> > >
>> > >  <osgi:service id="simpleServiceOsgi" ref="simpleService"
>> > >
>> > > interface="org.springframework.osgi.samples.simpleservice.MyService
"
>> > />
>> > >
>> > > </beans>
>> > >
>> > > -------------------------------------------
>> > >
>> > > Thank you
>> > >
>> > > Sameera
>> > >
>> > >
>> > > On 4/24/07, Stuart McCulloch < [EMAIL PROTECTED]> wrote:
>> > >>
>> > >> On 25/04/07, Sameera Withanage <[EMAIL PROTECTED]>
wrote:
>> > >> > I'm using the Felix built from trunk.
>> > >> >
>> > >> > Here is the exception...
>> > >> >
>> > >> > java.lang.NumberFormatException: For input string: "${pom"
>> > >>
>> > >> Looks like it's using a manifest that hasn't been filtered by
maven
>> > >> and still has the ${pom....} variable, which of course is not
>> valid.
>> > >> The warnings from spring-osgi are possibly related - build issue?
>> > >>
>> > >> Are you loading this bundle from a jar or directory?
>> > >>
>> > >> Could you provide a jar / directory listing along with the
>> manifest?
>> > >>
>> > >> >     at java.lang.NumberFormatException.forInputString(
>> > >> > NumberFormatException.java :48)
>> > >> >     at java.lang.Integer.parseInt(Integer.java:447)
>> > >> >     at java.lang.Integer.parseInt(Integer.java:497)
>> > >> >     at org.osgi.framework.Version.<init>(Version.java:127)
>> > >> >     at org.osgi.framework.Version.parseVersion (Version.java
:208)
>> > >> > at org.apache.felix.framework.Felix.createModule(Felix.java
>> > :3112)
>> > >> >     at org.apache.felix.framework.Felix.createBundleInfo (
>> > Felix.java
>> > >> :3057)
>> > >> >     at org.apache.felix.framework.Felix.installBundle
>> > >> (Felix.java:1961)
>> > >> >     at org.apache.felix.framework.Felix.start(Felix.java:443)
>> > >> >     at
>> com.aeturnum.athiva.rnd.FelixHost.<init>(FelixHost.java:82)
>> > >> >     at com.aeturnum.athiva.rnd.Main.main(Main.java:17)
>> > >> > org.osgi.framework.BundleException : Could not create bundle
>> > object.
>> > >> > at org.apache.felix.framework.Felix.installBundle(Felix.java
>> > :2012)
>> > >> >     at org.apache.felix.framework.Felix.start(Felix.java:443)
>> > >> > at com.aeturnum.athiva.rnd.FelixHost .<init>( FelixHost.java
>> > :82)
>> > >> >     at com.aeturnum.athiva.rnd.Main.main(Main.java:17)
>> > >> > Caused by: java.lang.NumberFormatException: For input string:
>> > "${pom"
>> > >> >     at java.lang.NumberFormatException.forInputString(
>> > >> > NumberFormatException.java :48)
>> > >> >     at java.lang.Integer.parseInt(Integer.java:447)
>> > >> >     at java.lang.Integer.parseInt(Integer.java :497)
>> > >> >     at org.osgi.framework.Version.<init>(Version.java:127)
>> > >> >     at org.osgi.framework.Version.parseVersion (Version.java
:208)
>> > >> > at org.apache.felix.framework.Felix.createModule (Felix.java
>> > :3112)
>> > >> >     at
>> org.apache.felix.framework.Felix.createBundleInfo(Felix.java
>> > >> :3057)
>> > >> >     at org.apache.felix.framework.Felix.installBundle
>> > >> (Felix.java:1961)
>> > >> >     ... 3 more
>> > >> >
>> > >> >
>> > >> > And additionally once I start a spring bundle it gives this
>> > >> warnings and
>> > >> not
>> > >> > registering services exported from it.
>> > >> >
>> > >> > WARNING: META-INF/spring.handlers (
>> > >> > org.apache.felix.moduleloader.ResourceNotFoundException:
>> > >> > META-INF/spring.handlers)
>> > >> > WARNING: META-INF/spring.schemas (
>> > >> > org.apache.felix.moduleloader.ResourceNotFoundException:
>> > >> > META-INF/spring.schemas)
>> > >> >
>> > >> > I'm still new to relate this exception to some place, but this
>> > bundle
>> > >> works
>> > >> > fine in standalone felix and it registers the services as well.
>> > >> >
>> > >> > Thank you
>> > >> >
>> > >> > Sameera
>> > >> >
>> > >> >
>> > >> > On 4/24/07, Richard S. Hall <[EMAIL PROTECTED]> wrote:
>> > >> > >
>> > >> > > Could you post the exception?
>> > >> > >
>> > >> > > Also, are you using Felix built from trunk or 0.8.0-incubator?
>> > >> > >
>> > >> > > -> richard
>> > >> > >
>> > >> > > Sameera Withanage wrote:
>> > >> > > > Hi,
>> > >> > > >
>> > >> > > > I'm embedding Felix in a host application following the
>> > examples
>> > >> given
>> > >> > > in
>> > >> > > > Felix site. When I'm trying to install a bundle, for
instance
>> > >> > > > spring-osgi,
>> > >> > > > it gives NumberformatException. I installed the same set of
>> > >> bundles
>> > >> > > using
>> > >> > > > standalone Felix console and all started successfully. I
>> > couldn't
>> > >> > > > figure out
>> > >> > > > why the same is not happening at embedded version.
>> > >> > > >
>> > >> > > > I tried removing all the META-INF/maven folders from jar
>> > >> bundles and
>> > >> > > > found
>> > >> > > > all bundles are starting, but it seems not practicle to
>> always
>> > >> edit
>> > >> > > > bundles.
>> > >> > > >
>> > >> > > > Any help would be greatly appreciated.
>> > >> > > >
>> > >> > > > Sameera
>> > >> > > >
>> > >> > >
>> > >> >
>> > >>
>> > >>
>> > >> --
>> > >> Cheers, Stuart
>> > >>
>> > >
>> >
>>
>>
>


Reply via email to