dev@glassfish.java.net

Re: injection-target?

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Fri, 21 Sep 2007 13:58:10 -0700

Bill Shannon wrote:
> Peter Williams wrote:
>> Is the <injection-target> element supposed to be a valid element in a
>> user's JavaEE5 standard descriptor file?
>>
>> The spec is somewhat vague, but near as I can tell this should be
>> legal and in fact is the correct way for the deployer role to
>> override an annotated injection dependency without recompiling.
>>
>> The javaee5_xsd includes a definition of this type but the various
>> type definitions for the reference types for which this ought to be
>> valid do not include it as a child. The end result is that if you
>> use this in a project (say inside NetBeans), the XML parser will
>> declare your descriptor file as invalid with an error. For example,
>> a service-ref with an injection-target node, the error is
>> "cvs-complex-type.2.4.a: Invalid context was found starting with
>> element 'injection-target'. One of
>> '{"http://java.sun.com/xml/ns/javaee":port-component-ref,
>> "http://java.sun.com/xml/ns/javaee":handler,
>> "http://java.sun.com/xml/ns/javaee":handler-chains}' is expected."
>>
>> An application using this will pass the verifier though.
>>
>> So, are the descriptor schemas for JavaEE5 broken? Is the JDK's XML
>> schema based validating parser broken? Or is there some other spec
>> weirdness going on here (such as this entry is only for use by the
>> server)?
>
> It should work. I just tried a simple example and it worked
> for me (which is to say that the XML parser and schema verifier
> said it was ok.)
>
> Here's the example I tried:
>
> <service-ref>
> <description>google service ref</description>
> <service-ref-name>service/GoogleSearch</service-ref-name>
>
> <service-interface>googleclient.GoogleSearchService</service-interface>
> <wsdl-file>GoogleSearch.wsdl</wsdl-file>
> <jaxrpc-mapping-file>googleclient.model</jaxrpc-mapping-file>
> <injection-target>
> <injection-target-class>com.example.MyApp</injection-target-class>
> <injection-target-name>id9</injection-target-name>
> </injection-target>
> </service-ref>
>
> Is there a problem with the JDK version or parser version you're using?
I don't know. I wouldn't have expected there to be. I will check the
way the XML parsing is being initialized in NetBeans and which parser is
being used. Sounds like it's probably a bug on our (NetBeans) side.

Reusing the schemas from the FCS build of Glassfish V1 or V2 from
lib/schemas should be correct, right?

-Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>