-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caused by: javax.enterprise.inject.CreationException: java.lang.NullPointerException #83
Comments
Exception --> 17:48:02.081 [Karaf Shell C] ERROR o.j.w.e.o.i.e.OSGiServiceBean - Unable to instantiate OSGiServiceBean [CdiCamelContext] with qualifiers [@Any @OSGiService @filter(value=)] due to java.lang.NullPointerException |
Hey Charles, is it possible to get your code or at least your dependencies so I can test your use case and debug ? |
Charles can you try to do something like : @publish
@ApplicationScoped
public class CdiCamelContextImpl implements CdiCamelContext {
private final DefaultCamelContext context = new DefaultCamelContext();
public CdiCamelContextImpl() {
context.setRegistry(new CdiBeanRegistry());
context.setInjector(new CdiInjector(getInjector()));
}
@Override
public DefaultCamelContext context() {
return this.context;
}
} Here I just want to know if the error come from the framework itself or from the creation of the CamelContext |
Le code de camel-cdi se trouve ici : https://svn.apache.org/repos/asf/camel/trunk/components/camel-cdi/ et mon example dans github https://github.com/cmoulliard/cdi-camel-example/ Je n'ai pas committe ni dans camel-cdi ni dans min mon repo github les Pour tester karaf, c'est simple --> tu le récupère ici Ensuite tu lances ./karaf dans le répertoire bin et tu déploies le projet avec les commandes suivantes features:addurl Tu copies les jars de weld-osgi dans le répertoire deploy de karaf. En [ 50] [Active ] [ ] [ ] [ 80] Charles On Fri, Jun 15, 2012 at 10:16 AM, Mathieu ANCELIN <
|
Meme erreur : 11:26:39.326 [FelixStartLev] ERROR o.j.w.e.o.i.i.ServicePublisher - Unable Si je retire @ApplicationScoped idem 11:30:07.476 [FelixStartLev] ERROR o.j.w.e.o.i.i.ServicePublisher - Unable On Fri, Jun 15, 2012 at 10:32 AM, Mathieu ANCELIN <
|
I don't know why the ApplicationScoped fails, it seems to be a proxy error. Anyway the error seems to come from org.apache.camel.component.cdi.CdiCamelContext2Impl.(CdiCamelContext2Impl.java:12). What happens here ? |
I think that it fails to create the CdiBeanRegistry line 12 --> context.setRegistry(new CdiBeanRegistry()); package org.apache.camel.component.cdi; import java.util.HashMap; import javax.enterprise.inject.spi.Bean; import org.apache.camel.spi.Registry; /**
On Fri, Jun 15, 2012 at 12:18 PM, Mathieu ANCELIN <
|
The Apache felix-3003 JIRA ticket has solved the error reported earlier in my post : Caused by: java.lang.NullPointerException This is fixed in Felix framework 4.0.3. I have had another error after retesting in Karaf 2.3 with Felix 4.0.3 Caused by: java.lang.IllegalArgumentException: class org.apache.camel.component.cdi.CdiCamelContext is not visible from class loader that I have solved with the following modification in org.jboss.weld.environment.osgi.impl.extension.OSGiServiceBean
Regards, Charles |
Hi,
The following config generates this error at the console of Karaf and in the log
Console of Karaf
17:32:39.878 [fileinstall-/] INFO o.j.w.e.o.i.i.ServicePublisher - Registering/Starting OSGi Service for bundle org.apache.camel.camel-cdi
17:32:39.879 [fileinstall-/] INFO o.j.w.e.o.i.i.ServicePublisher - Registering OSGi service org.apache.camel.component.cdi.CdiCamelContext as org.apache.camel.component.cdi.CdiCamelContext
17:32:40.099 [fileinstall-/] INFO o.j.w.e.o.i.i.Weld - Starting Weld instance for bundle camel-cdi [86]
17:32:40.099 [fileinstall-/] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
17:32:40.125 [fileinstall-/] INFO o.j.w.e.o.i.i.ServicePublisher - Registering/Starting OSGi Service for bundle camel-cdi
17:32:40.127 [fileinstall-/] ERROR o.j.w.e.o.i.e.OSGiServiceBean - Unable to instantiate OSGiServiceBean [CdiCamelContext] with qualifiers [@Any @OSGiService @filter(value=)] due to java.lang.NullPointerException
17:
Log
2012-06-14 17:35:05,823 | WARN | raf-2.2.7/deploy | fileinstall | 6 - org.apache.felix.fileinstall - 3.2.2 | Error while starting bundle: file:/Users/chmoulli/MyApplications/apache-karaf-2.2.7/deploy/weld-osgi-core-extension-1.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Activator start error in bundle org.jboss.weld.osgi.weld-osgi-core-extension [51].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1889)[org.apache.felix.framework-3.0.9.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:1759)[org.apache.felix.framework-3.0.9.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:918)[org.apache.felix.framework-3.0.9.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1246)[6:org.apache.felix.fileinstall:3.2.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1220)[6:org.apache.felix.fileinstall:3.2.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1209)[6:org.apache.felix.fileinstall:3.2.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:500)[6:org.apache.felix.fileinstall:3.2.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.2.2]
Caused by: javax.enterprise.inject.CreationException: java.lang.NullPointerException
at org.jboss.weld.environment.osgi.impl.extension.OSGiServiceBean.create(OSGiServiceBean.java:177)[51:org.jboss.weld.osgi.weld-osgi-core-extension:1.2.0.SNAPSHOT]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:64)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:623)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:688)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:119)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:162)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:158)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:132)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:154)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:291)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:64)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:623)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:228)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:576)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:566)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:561)[52:org.jboss.weld.osgi.weld-osgi-core-mandatory:1.2.0.SNAPSHOT]
at org.jboss.weld.environment.osgi.impl.integration.IntegrationActivator.startManagement(IntegrationActivator.java:235)[51:org.jboss.weld.osgi.weld-osgi-core-extension:1.2.0.SNAPSHOT]
at org.jboss.weld.environment.osgi.impl.integration.IntegrationActivator.startCDIOSGi(IntegrationActivator.java:115)[51:org.jboss.weld.osgi.weld-osgi-core-extension:1.2.0.SNAPSHOT]
at org.jboss.weld.environment.osgi.impl.integration.IntegrationActivator.start(IntegrationActivator.java:83)[51:org.jboss.weld.osgi.weld-osgi-core-extension:1.2.0.SNAPSHOT]
at org.jboss.weld.environment.osgi.impl.Activator.start(Activator.java:62)[51:org.jboss.weld.osgi.weld-osgi-core-extension:1.2.0.SNAPSHOT]
Bundle Camel-CDI
@publish
public class CdiCamelContext extends DefaultCamelContext {
}
Bundle Example
public class BootStrap {
Regards,
Charles
The text was updated successfully, but these errors were encountered: