[jboss-dev-forums] [Design of JBossXB] - Re: JBossXB should swap out the Context ClassLoader before i
rodos77
do-not-reply at jboss.com
Wed Aug 19 12:39:11 EDT 2009
Ok, I've created 2 patches for swapping out the context classloader. One for a class in the jbossweb project and one for a class in the JBossXB project. Either patch, when applied to the corresponding project, resolves the issue. You can now decide in which project it is more appropriate to fix this issue and apply the patch to the corresponding source repository to resolve this once and for all.
JBossXB patch:
| *** orig\org\jboss\xb\binding\UnmarshallerFactory.java 2009-04-19 20:18:06.000000000 -0400
| --- new\org\jboss\xb\binding\UnmarshallerFactory.java 2009-08-19 12:13:34.345631600 -0400
| ***************
| *** 90,95 ****
| --- 90,98 ----
| {
| public Unmarshaller newUnmarshaller()
| {
| + ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
| + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
| +
| UnmarshallerImpl unmarshaller;
| try
| {
| ***************
| *** 99,104 ****
| --- 102,111 ----
| {
| throw new JBossXBRuntimeException(e.getMessage(), e);
| }
| + finally
| + {
| + Thread.currentThread().setContextClassLoader(oldCl);
| + }
|
| JBossXBParser parser = unmarshaller.getParser();
| if(validation != null)
|
|
jbossweb patch:
| *** orig\org\jboss\web\tomcat\service\deployers\JBossContextConfig.java 2009-05-22 09:10:46.000000000 -0400
| --- new\org\jboss\web\tomcat\service\deployers\JBossContextConfig.java 2009-08-19 12:32:46.517506600 -0400
| ***************
| *** 542,547 ****
| --- 542,550 ----
|
| protected void processContextConfig(String resourceName, boolean local)
| {
| + ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
| + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
| +
| ContextMetaData contextMetaData = null;
| try
| {
| ***************
| *** 593,598 ****
| --- 596,605 ----
| ok = false;
| return;
| }
| + finally
| + {
| + Thread.currentThread().setContextClassLoader(oldCl);
| + }
|
| if (contextMetaData != null)
| {
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250447#4250447
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250447
More information about the jboss-dev-forums
mailing list