[jboss-as7-dev] Issue in EJB ?

Jaikiran Pai jpai at redhat.com
Sat Jul 23 10:55:53 EDT 2011


This one really doesn't have to do anything with Webservice or EJB. It's 
plain JAXP issue within AS7. Here's a bean/testcase which easily 
reproduces it 
https://github.com/jaikiran/jboss-as/commit/4e25a7771698c4745ac7594679f7331d3795c758. 
Here's the relevant part from that EJB code:

@Stateless
public class StatelessWSAccessingDataTypeFactory {

     private static final Logger logger = 
Logger.getLogger(StatelessWSAccessingDataTypeFactory.class);

     private static final Duration duration;

     static {
         try {
             duration = 
DatatypeFactory.newInstance().newDuration(86400000L);
        ...
     }

This results in a CNFE http://pastebin.com/3tgtrhnx. The important piece 
here is the static initialization block of the bean. This gets invoked 
during the deployment stage when the TCCL is null. The JAXP 
DataTypeFactory relies on TCCL to be set. If the TCCL is null it just 
throws a CNFE, like it does here, instead of falling back on the system 
classloader. This probably is a bug in JAXP, since from what I see the 
JAXP XMLInputFactory falls back to system classloader in the absence of 
TCCL being set. @see 
javax.xml.stream.SecuritySupport.getContextClassLoader() and compare it 
to the buggy(?) 
javax.xml.datatype.SecuritySupport.getContextClassLoader(). I think the 
DataTypeFactory should be falling back to system classloader in the 
absence of TCCL. Thoughts? How do we fix this?

As for a workaround, Jim, moving that static initialization into a 
@PostConstruct method should get you past this issue.

-Jaikiran
On Saturday 23 July 2011 10:26 AM, Jaikiran Pai wrote:
> Missed this thread. Will look into this today.
>
> -Jaikiran
> On Saturday 23 July 2011 10:18 AM, Jason Greene wrote:
>> Did anyone look into this?
>>
>> Sent from my iPad
>>
>> On Jul 20, 2011, at 2:52 AM, Jim Ma<ema at redhat.com
>> <mailto:ema at redhat.com>>  wrote:
>>
>>> I tried to deploy a webserivce endpoint impl with @Stateless
>>> annotation packaged in a war file which works with AS5 and AS6  into
>>> latest AS7 snapshot and got  CNF exception.
>>> Below I list the error statck trace ,  endpoint impl class and the
>>> web.xml used to deploy this ws endpoint.   From the error stack trace
>>> , it looks like the issue in ejb side ? But it works
>>> when I deploy this endpoint with an ejb jar file.   Is it another
>>> classloader issue ?
>>>
>>> Thanks
>>> Jim
>>>
>>>
>>> -------------------error message------------------
>>>
>>>    1.
>>>        de/git-client/maerqiang-work/jboss-as/build/target/jboss-as-7.1.0.Alpha1-SNAPSHOT/standalone/data/wsdl/jaxws-benchmark-datatypes-pojo.war/EndpointWrappedRPCService.wsdl
>>>    2.
>>>        11:03:14,450 ERROR [stderr] (MSC service thread 1-12)
>>>        javax.xml.datatype.DatatypeConfigurationException: Provider
>>>        __redirected.__DatatypeFactory not found
>>>    3.
>>>        11:03:14,451 ERROR [stderr] (MSC service thread 1-12) at
>>>        javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:137)
>>>    4.
>>>        11:03:14,451 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.test.ws.jaxws.benchmark.test.datatypes.EndpointPOJOWrappedDocImpl.<clinit>(EndpointPOJOWrappedDocImpl.java:54)
>>>    5.
>>>        11:03:14,452 ERROR [stderr] (MSC service thread 1-12) at
>>>        sun.misc.Unsafe.ensureClassInitialized(Native Method)
>>>    6.
>>>        11:03:14,452 ERROR [stderr] (MSC service thread 1-12) at
>>>        sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
>>>    7.
>>>        11:03:14,453 ERROR [stderr] (MSC service thread 1-12) at
>>>        sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
>>>    8.
>>>        11:03:14,453 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
>>>    9.
>>>        11:03:14,454 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.reflect.Field.getFieldAccessor(Field.java:899)
>>>   10.
>>>        11:03:14,454 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.reflect.Field.get(Field.java:358)
>>>   11.
>>>        11:03:14,454 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.invocation.proxy.AbstractProxyFactory$MethodAccessibilitySetter.run(AbstractProxyFactory.java:253)
>>>   12.
>>>        11:03:14,455 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.invocation.proxy.AbstractProxyFactory$MethodAccessibilitySetter.run(AbstractProxyFactory.java:244)
>>>   13.
>>>        11:03:14,455 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.security.AccessController.doPrivileged(Native Method)
>>>   14.
>>>        11:03:14,456 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.invocation.proxy.AbstractProxyFactory.afterClassLoad(AbstractProxyFactory.java:108)
>>>   15.
>>>        11:03:14,456 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:158)
>>>   16.
>>>        11:03:14,457 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:118)
>>>   17.
>>>        11:03:14,457 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$2.configure(StatelessComponentDescription.java:121)
>>>   18.
>>>        11:03:14,457 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.as.ee.component.ComponentDescription$DefaultFirstConfigurator.configure(ComponentDescription.java:778)
>>>   19.
>>>        11:03:14,458 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.as.ee.component.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:65)
>>>   20.
>>>        11:03:14,458 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
>>>   21.
>>>        11:03:14,459 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
>>>   22.
>>>        11:03:14,459 ERROR [stderr] (MSC service thread 1-12) at
>>>        org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
>>>   23.
>>>        11:03:14,459 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
>>>        r.java:886)
>>>   24.
>>>        11:03:14,460 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>   25.
>>>        11:03:14,460 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.Thread.run(Thread.java:662)
>>>   26.
>>>        11:03:14,461 ERROR [stderr] (MSC service thread 1-12) Caused
>>>        by: java.lang.ClassNotFoundException:
>>>        __redirected/__DatatypeFactory
>>>   27.
>>>        11:03:14,461 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.Class.forName0(Native Method)
>>>   28.
>>>        11:03:14,462 ERROR [stderr] (MSC service thread 1-12) at
>>>        java.lang.Class.forName(Class.java:247)
>>>   29.
>>>        11:03:14,462 ERROR [stderr ] (MSC service thread 1-12) at
>>>        javax.xml.datatype.FactoryFinder.getProviderClass(FactoryFinder.java:121)
>>>   30.
>>>        11:03:14,463 ERROR [stderr] (MSC service thread 1-12) at
>>>        javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:146)
>>>   31.
>>>        11:03:14,463 ERROR [stderr] (MSC service thread 1-12) at
>>>        javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:187)
>>>   32.
>>>        11:03:14,463 ERROR [stderr] (MSC service thread 1-12) at
>>>        javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:131)
>>>   33.
>>>        11:03:14,464 ERROR [stderr] (MSC service thread 1-12) ... 22 more
>>>
>>> -------------------EndpointPOJOWrappedDocImpl.java------------------
>>> @WebService(serviceName = "EndpointWrappedDocService", portName =
>>> "EndpointWrappedDocPort", endpointInterface =
>>> "org.jboss.test.ws.jaxws.benchmark.test.datatypes.EndpointWrappedDoc") @Stateless
>>> public class EndpointPOJOWrappedDocImpl implements EndpointDoc {
>>> private static Duration dayDuration; static { try { dayDuration =
>>> DatatypeFactory.newInstance().newDuration(86400000L); } catch
>>> (DatatypeConfigurationException e) { dayDuration = null;
>>> e.printStackTrace(); } } private static final List<String>
>>> stringList; static { stringList = new ArrayList<String>(); for (int i
>>> = 0; i<  10; i++) { stringList.add("item " + i); } } public String
>>> sayHello(String toWhom) { String greeting = "Hello World Greeting for
>>> '" + toWhom + "' today"; return greeting; } }
>>> -------web.xml----------<?xml version="1.0" encoding="UTF-8"?>
>>> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
>>> <servlet>  <servlet-name>EndpointPOJOWrappedDocImpl</servlet-name>
>>> <servlet-class>org.jboss.test.ws.jaxws.benchmark.test.datatypes.EndpointPOJOWrappedDocImpl</servlet-class>
>>> </servlet>  <servlet-mapping>
>>> <servlet-name>EndpointPOJOWrappedDocImpl</servlet-name>
>>> <url-pattern>/EndpointPOJOWrappedDocImpl</url-pattern>
>>> </servlet-mapping>  </web-app>
>>>
>>>
>>>
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> jboss-as7-dev at lists.jboss.org<mailto:jboss-as7-dev at lists.jboss.org>
>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>>
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev



More information about the jboss-as7-dev mailing list