JBoss Community

Re: Using JAXB and see java.lang.ClassNotFoundException: __redirected/__DatatypeFactory

created by Jason Greene in JBoss AS7 Development - View the full discussion

My above answer is not entirely accurate. The TCCL needs to point to any module classloader (all of them can see __redirected). In some cases TCCL might be null, in which case the boot classpath is used and __redirected is not seen. Before calling into any JAXP factory (any newInstance()) just make sure you set TCCL to point to your module classloader (and reset it back to the original in finally block)

 

One important clarification point though is that if this is an EE deployment executing in an EE context (like say servlet init), then it has TCCL set to the deployment (which is correct). If you are taking an action on behalf of the user (e.g. it is expected that THEIR JAXP impls be used), then you can safely reuse this. If however it is an implementation detail of your subsystem, then you want your versions to be used and not theirs.

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community