OpenLiberty / liberty-language-server

The Liberty Config Language Server provides language server features for Liberty server configuration files through any of the supported client IDEs.
Eclipse Public License 2.0
6 stars 12 forks source link

Validation error for `properties.wmqJmsRA` elements in `resourceAdapter` element in server.xml #173

Open cherylking opened 1 year ago

cherylking commented 1 year ago

This error was reported by Danny Haase in IBM Consulting. When he added the properties.wmqJmsRA element inside the resourceAdapter element, Liberty Tools flags a diagnostic error. According to Alasdair, "properties.wmqJmsRA will only be in the server.xsd if it is generated with the server schema generator rather than the install schema generator since it only exists because the RA is installed.".

We currently use the install schema generator located at bin/tools/ws-schemagen.jar. In order to generate a schema that would recognize the properties.wmqJmsRA element, we would need to use the bin/tools/ws-serverSchemagen.jar instead. Alasdair advised that we may only want to use the serverSchemagen.jar when the resourceAdapter element is present, because it may perform slower than the ws-schemagen.jar.

One thing that we will need to determine is once the resourceAdapter element is added to server.xml, is the resource adapter immediately installed? Or does it only get installed once the server is started?

cherylking commented 1 year ago

I just attempted to use the serverSchemaGen script in a locally installed Open Liberty runtime where I had a test server already created. I got the following error:

./serverSchemaGen test  
CWWKG3002E: The server named test is not configured to accept local JMX requests. Ensure that the server configuration includes the localConnector feature, and that the server is started.

So not only does the server need to be running, but it also needs the localConnector feature configured.

cherylking commented 1 year ago

Here is the doc for the serverSchemaGen command, which backs up my assertion that the server needs to be running and must contain the localConnector feature.

scottkurz commented 1 year ago

@cherylking I wonder if the original problem goes away if we make the change in https://github.com/OpenLiberty/liberty-language-server/pull/189.

The generated XSD from this type (which I think is the type for resourceAdapter) would end up looking like:

    <xsd:complexType name="com.ibm.ws.jca.embeddedResourceAdapter"> 
        <xsd:choice minOccurs="0" maxOccurs="unbounded"> 
            <xsd:element name="customize" type="com.ibm.ws.jca.embeddedResourceAdapter.customize"> 
            </xsd:element> 
            <xsd:any processContents="skip" minOccurs="0" maxOccurs="1"/> 
        </xsd:choice> 
       ...

So the <xsd:any> there is new, it's only in the XSD generated assuming we make that change.

It's probably easier to just verify on the full, original server.xml than to try to reason through looking at the XSD.