[weld-issues] [JBoss JIRA] Closed: (WELD-445) NullPointerException

Pete Muir (JIRA) jira-events at lists.jboss.org
Sat Feb 20 16:52:10 EST 2010


     [ https://jira.jboss.org/jira/browse/WELD-445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pete Muir closed WELD-445.
--------------------------

         Assignee: Pete Muir
       Resolution: Cannot Reproduce Bug
    Fix Version/s:     (was: 1.0.1.GA)


I wrote a test and couldn't see this problem. I did use a JDK Logger, rather the log4j as I don't have that library available in our testsuite.

http://fisheye.jboss.org/changelog/weld/?cs=5906

If you can reproduce this issue with no external dependencies using the 1.0.1 release (available soon), please reopen :-)

> NullPointerException 
> ---------------------
>
>                 Key: WELD-445
>                 URL: https://jira.jboss.org/jira/browse/WELD-445
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.0.1.CR2
>         Environment: JBoss 6.0.0 M2 updated with Weld 1.0.1 CR2, Windows XP
>            Reporter: Ian
>            Assignee: Pete Muir
>
> I get a NullPointerException when trying to inject a logger into my code. It happens in two circumstances - once when injection is done by the container, once when I manually inject (using the SPI of course!).
> The top of the stack trace is exactly the same in both instances:
> java.lang.NullPointerException org.jboss.weld.util.Beans.isPassivatingScope(Beans.java:132) org.jboss.weld.bean.AbstractProducerBean.checkReturnValue(AbstractProducerBean.java:263) org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:349) org.jboss.weld.context.DependentContext.get(DependentContext.java:62) org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:788) org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:850) org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:874) org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:108) org.jboss.weld.util.Beans.injectBoundFields(Beans.java:775) org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:787) org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:122) org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:51) org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:116) 
> The code fragment for the item being injected is the following: (the logger is a log4j logger)
> public class LoggingFactory {
>     @Produces
>     Logger createLogger(InjectionPoint injectionPoint) {
> 	return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
>     }
> }
> The servletContextListener code fragment is as follows:
> public class ApplicationInitialisation
> 	implements ServletContextListener {
>     @Inject
>     private Logger log;
>     /**
>      * @see ServletContextListener#contextInitialized(ServletContextEvent)
>      */
>     public void contextInitialized(ServletContextEvent event) {
>         // Never gets into the method because of the stack trace
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the weld-issues mailing list