[jboss-jira] [JBoss JIRA] Commented: (JBMETA-208) Prescence of an ejb-jar.xml without a namespace stops annotation-based metadata processing
Richard Kennard (JIRA)
jira-events at lists.jboss.org
Wed Jul 1 19:34:51 EDT 2009
[ https://jira.jboss.org/jira/browse/JBMETA-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12474526#action_12474526 ]
Richard Kennard commented on JBMETA-208:
----------------------------------------
Thank you all for the time and thought you have put into this. I think everybody's position is very reasonable. In particular, I understand...
"When a JAR is deployed, we first look whether there is an ejb-jar.xml. And if it's there we can tell by its version which EJB version this deployment is. And if it's EJB2 then does it make sense to look into each class in the JAR to make sure there are no EJB3 annotations? Because this is what you are asking for. It's rather expensive performance-wise."
At the same time, though, I would counsel that "the deployment should have been completely skipped from the EJB3 processing", without any warning, is rather dangerous. Even though the EJB 3.0 spec might mandate "all EJB deployment descriptors must indicate the ejb-jar schema by using the Java EE namespace" plenty of examples and tutorials on the Web, for reasons of brevity or simply laziness, omit it. For example:
http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html
You can fix the JBoss ones, but not all the third-party ones. If I may humbly suggest a solution:
1. Scan the ejb-jar.xml
2. If it contains a DTD, treat it as EJB 2.x (or 1.x) and don't scan for annotations
3. If it contains a namespace, treat it as EJB 3.x (or above) and scan for annotations
4. If it contains neither a DTD nor a namespace, display a warning that you are entering 'compatibility mode' where you both process the ejb-jar.xml and scan for annotations (at the expense of reduced startup time). The warning should advise the developer 'either add a DTD or a namespace to avoid this warning'
In some ways this is more accurate, because if there is no DTD or namespace you really can't say what version it is.
Regards,
Richard.
> Prescence of an ejb-jar.xml without a namespace stops annotation-based metadata processing
> ------------------------------------------------------------------------------------------
>
> Key: JBMETA-208
> URL: https://jira.jboss.org/jira/browse/JBMETA-208
> Project: JBoss Metadata
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 1.0.1.GA
> Environment: JBoss AS 5.1.0.GA
> Reporter: Richard Kennard
> Assignee: Alexey Loubyansky
>
> The presence of a META-INF/ejb-jar.xml file that is not properly namespaced, for example...
> <ejb-jar>
> </ejb-jar>
> ...instead of...
> <ejb-jar version="3.0"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
> </ejb-jar>
> ...stops ALL of the annotation-based metadata processing. Every session bean in the JAR reports with the JBMETA-4 warning, and therefore none of them get registered with JNDI. This is much worse than simply ignoring the ejb-jar.xml altogether, as is arguably acceptable as it isn't namespaced.
> An un-namespaced ejb-jar.xml is not uncommon. Many examples, including this one from the JBoss documentation...
> http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html
> ...leave off the namespace, so for JBoss to fail without warning seems a little harsh. Leaving off the namespace worked fine in JBoss 4.2.3.GA.
--
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
More information about the jboss-jira
mailing list