[jboss-as7-dev] [Resteasy-developers] NPE at org.jboss.resteasy.logging.Logger.classInClasspath(Logger.java:62)

David M. Lloyd david.lloyd at redhat.com
Wed Jun 22 16:05:20 EDT 2011


I admit you have me baffled here.

Class.forName(name, false, classLoader); is no more likely to cause CCE 
or linkage errors than classLoader.loadClass(name).

It also has the benefit of being able to load array types and deal 
properly with the aforementioned null classLoader situation.  And, as an 
added bonus it gives you the option to initialize the class, which you 
can't do via plain calls on ClassLoader.  Overall it's a better API to use.

On 06/22/2011 03:01 PM, Bill Burke wrote:
> Using Class.forName() is perhaps one of the biggest causes of CCEs and CLEs.
>
>
> On 6/22/11 3:37 PM, David M. Lloyd wrote:
>> It is perfectly valid to have a context class loader of "null" which is
>> one value used by the JDK to mean the default system class loader.  You
>> can never assume the TCCL is non-null.  It's another good reason to use
>> Class.forName() instead of classLoader.loadClass().
>>
>> Thread.currentThread() will never be null.
>>
>> On 06/22/2011 02:30 PM, Bill Burke wrote:
>>> Not sure how that NPE is possible.  Thread.currentThread() or
>>> Thread.currentThread().getContextClassLoader() has to be NULL.  If AS7
>>> is overriding ContextClassLoader to be NULL then thats pretty worrisome.
>>>
>>> On 6/22/11 2:28 PM, Juergen Zimmermann wrote:
>>>> JBoss 7 (Jenkins build 1253) meanwhile works regarding the
>>>> NoMessageBodyWriterFoundFailure.
>>>>
>>>> However, when I want to also use Seam REST, I'm getting a NPE at
>>>> org.jboss.resteasy.logging.Logger.classInClasspath(Logger.java:62). Please
>>>> see the stacktrace:
>>>>
>>>> 20:20:06,541 INFO  [org.jboss.weld] (MSC service thread 1-1) Processing CDI
>>>> deployment: swe2.ear
>>>> 20:20:06,566 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1)
>>>> MSC00001: Failed to start service
>>>> jboss.deployment.unit."swe2.ear".POST_MODULE:
>>>> org.jboss.msc.service.StartException in service
>>>> jboss.deployment.unit."swe2.ear".POST_MODULE: Failed to process phase
>>>> POST_MODULE of deployment "swe2.ear"
>>>> 	at
>>>> org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUn
>>>> itPhaseService.java:121)
>>>> 	at
>>>> org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerI
>>>> mpl.java:1738)
>>>> 	at
>>>> org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControl
>>>> lerImpl.java:2325)
>>>> 	at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
>>>> va:886) [:1.6.0_26]
>>>> 	at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
>>>> 08) [:1.6.0_26]
>>>> 	at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
>>>> Caused by: java.lang.RuntimeException: Error instantiating class
>>>> org.jboss.resteasy.cdi.ResteasyCdiExtension
>>>> 	at
>>>> org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:282)
>>>> 	at
>>>> org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:238)
>>>> 	at
>>>> org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:194)
>>>> 	at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:157)
>>>> 	at
>>>> org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:346)
>>>> 	at
>>>> org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadA
>>>> ttachments(WeldPortableExtensionProcessor.java:84)
>>>> 	at
>>>> org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.deplo
>>>> y(WeldPortableExtensionProcessor.java:78)
>>>> 	at
>>>> org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUn
>>>> itPhaseService.java:115)
>>>> 	... 5 more
>>>> Caused by: java.lang.ExceptionInInitializerError
>>>> 	at
>>>> org.jboss.resteasy.cdi.ResteasyCdiExtension.<init>(ResteasyCdiExtension.java
>>>> :44)
>>>> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method) [:1.6.0_26]
>>>> 	at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
>>>> sorImpl.java:39) [:1.6.0_26]
>>>> 	at
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
>>>> torAccessorImpl.java:27) [:1.6.0_26]
>>>> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>> [:1.6.0_26]
>>>> 	at
>>>> org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:273)
>>>> 	... 12 more
>>>> Caused by: java.lang.NullPointerException
>>>> 	at
>>>> org.jboss.resteasy.logging.Logger.classInClasspath(Logger.java:62)
>>>> 	at org.jboss.resteasy.logging.Logger.<clinit>(Logger.java:75)
>>>> 	... 18 more
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Simplify data backup and recovery for your virtual environment with vRanger.
>>>> Installation's a snap, and flexible recovery options mean your data is safe,
>>>> secure and there when you need it. Data protection magic?
>>>> Nope - It's vRanger. Get your free trial download today.
>>>> http://p.sf.net/sfu/quest-sfdev2dev
>>>> _______________________________________________
>>>> Resteasy-developers mailing list
>>>> Resteasy-developers at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>
>>
>


-- 
- DML


More information about the jboss-as7-dev mailing list