On Jul 22, 2006, at 4:16 AM, Jacek Laskowski wrote:

On 7/18/06, David Blevins <[EMAIL PROTECTED]> wrote:
I have the start of support for the EJB3 ejb-jar.xml worked in using
JAXB.  It's working great and the itests run, the only trick is it
*only* supports ejb3 descriptors, i.e. you *must* have this at the
top of your ejb-jar.xml

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"; ...>

Using the previous namespace or using no namespace at all no longer
works.  This might be easy to solve, but I'm quite a JAXB novice.

The namespace info comes from an annotation in a package-info.java
class.  Don't know if there is some other way to specify it or
override the annotation.

Duh! I thought I found out a partial solution to the issue, which is
exactly what you'd written in the last paragraph. It's my first time
with JAXB and have been reading over the jaxb spec and java ee
tutorial and came up to the package-info.java file, which you had
already found out about. Funny, very funny! :)

Well the journey was worth it I suppose :)

Have you already sorted it out?

Nope.  Haven't poke at it at all since posting.

We could generate jaxb-generated
classes for the other spec dtds or xschemas and ...that's the other
piece I couldn't figure out yet. Do you have any ideas as to how to
work it out?

Generating all that code would be easy, using all that code would be hard.

The tree we have will parse all earlier ejb-jar.xml versions. It's really just the url of the namespace that's the issue.

On Jul 22, 2006, at 7:49 AM, Jacek Laskowski wrote:
I wish I could point to a unit test to show what the issue is, but
don't have it atm.

There is a test case here:
http://fisheye.codehaus.org/browse/openejb/trunk/openejb3/container/ openejb-jee/src/test/java/org/openejb/jee/EjbJarTest.java

You could probably add an older ejb-jar.xml and expand that test to try and marshal it as well.

Finding some way to make JAXB happy with the available namespaces (including none at all), would be ideal. The last resort of course is to modify the namespace on the fly or add one if it isn't there. Maybe a wrapper around an XMLStreamReader [1] that pulls a switcheroo [2] on the namespace before handing it over to JAXB. The downside is that it'd get complicated real quick.

-David

[1] http://java.sun.com/webservices/docs/1.5/api/javax/xml/stream/ XMLStreamReader.html
[2]  http://www.google.com/search?q=define:switcheroo

Jacek

--
Jacek Laskowski
http://www.laskowski.net.pl


Reply via email to