felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Romanov <alexey.v.roma...@gmail.com>
Subject Re: Problem with ipojo-bnd-plugin
Date Sat, 12 May 2012 12:38:14 GMT
Additional information. This works:

	@Bind
	public synchronized void bindDriver(Driver driver) {
		if (getCurrentDriverByName(driver) == null) {
//			drivers.put(driver.getName(), driver);
//			logger.info("Driver '{}' added", driver.getName());
//			for (OdpObjectClass objectClass : driver.getSupportedClasses()) {
//				objectRegistry.addObjectClass(objectClass);
//			}
		}
	}

but uncommenting

drivers.put(driver.getName(), driver);

restores the error.

Yours, Alexey Romanov


On Sat, May 12, 2012 at 4:24 PM, Alexey Romanov
<alexey.v.romanov@gmail.com> wrote:
> For some reason PojoizationPlugin is failing to handle this class:
>
> package ru.focusmedia.odp.server.sspd.impl;
>
> import java.util.Map;
>
> import org.apache.felix.ipojo.annotations.Bind;
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Instantiate;
> import org.apache.felix.ipojo.annotations.Provides;
> import org.apache.felix.ipojo.annotations.Requires;
> import org.apache.felix.ipojo.annotations.Unbind;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> import com.google.common.collect.Maps;
>
> import ru.focusmedia.odp.server.api.objects.OdpObjectClass;
> import ru.focusmedia.odp.server.drivers.api.Driver;
> import ru.focusmedia.odp.server.sspd.api.DriverRegistry;
> import ru.focusmedia.odp.server.sspd.api.ObjectRegistry;
>
> @Component
> //@Provides
> //@Instantiate
> public class DriverRegistryImpl implements DriverRegistry {
>        private final Logger logger = LoggerFactory.getLogger(getClass());
>        private Map<String, Driver> drivers = Maps.newHashMap();
>
> //      @Requires
>        private ObjectRegistry objectRegistry;
>
>        @Override
>        public Driver getDriver(String name) {
>                return drivers.get(name);
>        }
>
> //      @Bind
>        public synchronized void bindDriver(Driver driver) {
>                if (getCurrentDriverByName(driver) == null) {
>                        drivers.put(driver.getName(), driver);
>                        logger.info("Driver '{}' added", driver.getName());
>                        for (OdpObjectClass objectClass : driver.getSupportedClasses())
{
>                                objectRegistry.addObjectClass(objectClass);
>                        }
>                }
>        }
>
> //      @Unbind
>        public synchronized void unbindDriver(Driver driver) {
>                if (getCurrentDriverByName(driver) == driver) {
>                        drivers.remove(driver.getName());
>                        logger.info("Driver '{}' removed", driver.getName());
>                } else {
>                        logger.debug(
>                                        "Driver with name '{}' removed,
but it isn't currently the one
> registered for this name",
>                                        driver.getName());
>                }
>        }
>
>        private Driver getCurrentDriverByName(Driver driver) {
>                return drivers.get(driver.getName());
>        }
> }
>
>
> Same exception happens in Eclipse and from the command line:
>
> java.lang.IllegalStateException: ClassReader.accept() should be called
> with EXPAND_FRAMES flag
>        at org.objectweb.asm.commons.LocalVariablesSorter.visitFrame(Unknown Source)
>        at org.objectweb.asm.ClassReader.accept(Unknown Source)
>        at org.objectweb.asm.ClassReader.accept(Unknown Source)
>        at org.apache.felix.ipojo.manipulation.Manipulator.manipulate(Manipulator.java:100)
>        at org.apache.felix.ipojo.manipulator.ManipulationEngine.generate(ManipulationEngine.java:111)
>        at org.apache.felix.ipojo.manipulator.Pojoization.pojoization(Pojoization.java:312)
>        at org.apache.felix.ipojo.bnd.PojoizationPlugin.analyzeJar(PojoizationPlugin.java:118)
>        at aQute.lib.osgi.Analyzer.analyze(Analyzer.java:130)
>        at aQute.lib.osgi.Builder.analyze(Builder.java:306)
>        at aQute.lib.osgi.Analyzer.calcManifest(Analyzer.java:301)
>        at aQute.lib.osgi.Builder.build(Builder.java:73)
>        at org.apache.felix.bundleplugin.BundlePlugin.buildOSGiBundle(BundlePlugin.java:547)
>        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:347)
>        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
>        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
>        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>
>
> The error goes away after commenting out @Component or bindDriver and
> unbindDriver methods.
>
>
> Relevant part of pom.xml:
>
>        <build>
>                <plugins>
>                        <plugin>
>                                <groupId>org.apache.felix</groupId>
>                                <artifactId>maven-bundle-plugin</artifactId>
>                                <extensions>true</extensions>
>                                <configuration>
>                                        <instructions>
>                                                <_include>bnd.bnd</_include>
>                                        </instructions>
>                                </configuration>
>                        </plugin>
>                </plugins>
>        </build>
>
>
> bnd.bnd:
>
> -src:       src/main/java
> -classpath: target/classes
> -plugin: org.apache.felix.ipojo.bnd.PojoizationPlugin;path:="${basedir}/../cnf/plugins/bnd-ipojo-plugin-1.8.4-fat.jar";metadata=${basedir}/src/main/resources/metadata.xml;use-local-schemas=true
>
> Bundle-SymbolicName: ru.focusmedia.odp.server.sspd.impl
> Bundle-Version:      0.1.0
> Private-Package: ru.focusmedia.odp.server.sspd.impl.*
>
>
> bnd-ipojo-plugin-1.8.4-fat.jar mentioned in bnd.bnd is a single file
> containing bnd-ipojo-plugin and its dependencies.
>
> Yours, Alexey Romanov

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message