[jboss-user] [EJB/JBoss] - Re: PostConstruct loadClass fails when porting to JBoss 5
ALRubinger
do-not-reply at jboss.com
Wed Jul 29 00:51:09 EDT 2009
"jcstaff2" wrote : I understand where your caution comes from about the ClassLoader after reading the spec, but when I read the Javadoc on getClass().getResource(), it sounds like it too is locating the ClassLoader.
The difference is in your definition of "the".
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getResource(java.lang.String)
Class.getResource() uses the ClassLoader which defined the Class in question. So it's:
Class.getClassLoader().getResource()
...under the hood, and not:
Thread.currentThread().getContextClassLoader()
In theory the two could be the same. In fact, I'd say any access to any CL from application code is a no-no, as the application could change the internal mutable state of the CL itself which may lead to problems elsewhere. But the Class.getResource() case should be fine.
"jcstaff2" wrote : I finally tracked the issue down to the deployment descriptor. The JBoss 5 parsing of the deployment descriptor elements seems to now include white-space characters into values.
|
| (...snip)
|
| However the problem in porting from JBoss 4 to JBoss 5 ended up being a whitespace interpretation change of the ejb-jar.xml between the two versions.
This is expected.
http://java.sun.com/xml/ns/javaee/javaee_5.xsd
javaee:env-entry-value is of type javaee:xsdStringType which extends from xsd:string. Pure String types are not trimmed.
http://www.w3schools.com/Schema/schema_dtypes_string.asp
"jcstaff2" wrote : JBoss 5 is adding extra whitespace to the injected String variable.
Looks like *you* were adding the whitespace. :) We just became a bit more compliant/strict and stopped trimming it away.
S,
ALR
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246593#4246593
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246593
More information about the jboss-user
mailing list