[
https://jira.jboss.org/jira/browse/JBAS-5673?page=com.atlassian.jira.plug...
]
Stan Silvert reopened JBAS-5673:
--------------------------------
I'm reopening this because the fix can cause a NPE for JSF managed beans. I changed
the JSF integration test in the testsuite. If you run
org.jboss.test.web.test.JSFIntegrationTestCase you will see the NPE.
I used a JButton as a managed bean in faces-config.xml like this:
<managed-bean>
<description>Use a swing JButton as a simple javabean</description>
<managed-bean-name>myJButton</managed-bean-name>
<managed-bean-class>javax.swing.JButton</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>text</property-name>
<value>Initial Value</value>
</managed-property>
</managed-bean>
Note that this is an odd example. I'm not actually using JButton for anything other
than the fact that I can use it as a holder to getText()/setText(). But it is perfectly
valid to use a JDK class for this purpose.
The NPE is in TomcatInjectionContainer.isDymanicBean() where it says:
// Check if the object was loaded by a dynamic class loader (e.g. Jasper)
String classLoaderName = object.getClass().getClassLoader().getClass().getName();
if(dynamicClassLoaders.contains(classLoaderName))
return true;
Since JButton is loaded by the bootstrap classloader, object.getClass().getClassLoader()
will return null and you get a NPE.
Furthermore, as the code currently stands, it looks like any JSF managed bean that was not
loaded by Jasper's classloader will not have annotations processed. Most JSF
applications don't use JSP at all, so it looks to me like this code will often fail to
process annotations for managed beans.
Can you explain exactly what this code is trying to do?
Metadata processing needs to be redone
--------------------------------------
Key: JBAS-5673
URL:
https://jira.jboss.org/jira/browse/JBAS-5673
Project: JBoss Application Server
Issue Type: Sub-task
Security Level: Public(Everyone can see)
Components: Deployers, Web (Tomcat) service
Affects Versions: JBossAS-5.0.0.CR1
Reporter: Scott M Stark
Assignee: Emanuel Muckenhuber
Fix For: JBossAS-5.0.0.CR2
Currently there is duplicate processing of annotations happening in the web container
TomcatInjectionContainer. This needs to be redone based on the JBossWebMetaData being
produced by the annotation deployers. The only annotation scanning in the web container
would be dynamic elements not available via metadata such as jsp beans, etc.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira