Good morning!

TL;DR: You should create a fragment JAR containing
org/springframework/beans/factory/xml/spring-beans-2.0.xsd and attach it to
activemq-osgi (or SMX spring-beans).

I've checked the stack trace at
org.springframework.beans.factory.xml.DefaultDocumentLoader#loadDocument
and I see something weird. SAX entity resolver is an instance of
org.springframework.beans.factory.xml.ResourceEntityResolver delegating to
org.springframework.beans.factory.xml.PluggableSchemaResolver with 93
mappings:

"http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"; ->
{@9075} "org/springframework/beans/factory/xml/spring-beans-2.0.xsd"
"http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"; ->
{@9009} "org/springframework/beans/factory/xml/spring-beans-2.5.xsd"
"http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"; ->
{@9115} "org/springframework/beans/factory/xml/spring-beans-3.0.xsd"
"http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"; ->
{@9127} "org/springframework/beans/factory/xml/spring-beans-3.1.xsd"
"http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"; ->
{@9001} "org/springframework/beans/factory/xml/spring-beans-3.2.xsd"
"http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"; ->
{@8977} "org/springframework/beans/factory/xml/spring-beans-4.0.xsd"
"http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"; ->
{@9045} "org/springframework/beans/factory/xml/spring-beans-4.1.xsd"
"http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"; ->
{@9025} "org/springframework/beans/factory/xml/spring-beans-4.2.xsd"
"http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"; ->
{@9039} "org/springframework/beans/factory/xml/spring-beans-4.3.xsd"
"http://www.springframework.org/schema/beans/spring-beans.xsd"; -> {@9021}
"org/springframework/beans/factory/xml/spring-beans-4.3.xsd"

the problem is that spring-beans.xsd is mapped to spring-beans-4.3.xsd

And while
org.apache.servicemix.bundles.spring-beans-5.3.33_1.jar/META-INF/spring.schemas
is fine:

http\://
www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.2.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.3.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
http\://
www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans.xsd

There's also activemq-osgi-5.17.1.jar/META-INF/spring.schemas:

http\://
www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
http\://
www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.2.xsd=org/springframework/beans/factory/xml/spring-beans-4.2.xsd
http\://
www.springframework.org/schema/beans/spring-beans-4.3.xsd=org/springframework/beans/factory/xml/spring-beans-4.3.xsd
http\://
www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.3.xsd

which:

   1. overrides what's in SMX version of spring-beans
   2. doesn't reflect anything that's correct - activemq-osgi JAR doesn't
   ship these schemas.

In Karaf 4.2.x with ActiveMQ 5.15.11 (thanks for the versions!),
activemq-osgi-5.15.11.jar/META-INF/spring.schemas contains only:

http\://
www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
http\://
www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd
http\://
www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd
http\://
www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd

And I was just going to check why did it work with Karaf 4.2.16 + ActiveMQ
5.15.11, but I simply run it with www.springframework.org host pointing to
127.0.0.1 and I got this:

2024-10-18T09:41:32,764 | INFO  | features-3-thread-1 | FeaturesServiceImpl
             | 14 - org.apache.karaf.features.core - 4.2.16 |
org.apache.servicemix.bundles.velocity/1.7.0.6
2024-10-18T09:41:32,767 | INFO  | features-3-thread-1 | FeaturesServiceImpl
             | 14 - org.apache.karaf.features.core - 4.2.16 |
org.apache.activemq.activemq-web-console/5.15.11
2024-10-18T09:41:32,827 | WARN  | CM Configuration Updater
(ManagedServiceFactory Update: factoryPid=[org.apache.activemq.server]) |
XmlBeanDefinitionReader          | 104 -
org.apache.servicemix.bundles.spring-beans - 5.3.19.1 | Ignored XML
validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema
document 'http://www.springframework.org/schema/beans/spring-beans-2.0.xsd',
because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
~[?:?]
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:100)
[?:?]
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392)
[?:?]
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306)
[?:?]
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4257)
[?:?]
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4248)
[?:?]

+Jean-Baptiste Onofré <jeanbaptiste.ono...@gmail.com> I think activemq-osgi
JAR should NOT include Spring schema mappings in its
META-INF/spring.schemas...

kind regards
Grzegorz Grzybek

pt., 18 paź 2024 o 07:33 Luis Lozano <lozanofam...@gmail.com> napisał(a):

> Good morning.
> As a workaround, would it be possible to leave the file in a local
> directory? For example, inside the classpath.
> Is the file "spring-beans.xsd"?
>
> Thanks.
>
> El jue, 17 oct 2024 a las 18:56, Grzegorz Grzybek (<gr.grzy...@gmail.com>)
> escribió:
>
>> Ok, I've reproduced it by adding fake entry to /etc/hosts for
>> www.springframework.org host:
>>
>> 2024-10-17T18:54:25,105 | WARN  | CM Configuration Updater (Update:
>> pid=org.apache.activemq.server~default) | XmlBeanDefinitionReader
>>  | 62 - org.apache.servicemix.bundles.spring-beans - 5.3.33.1 | Ignored XML
>> validation warning
>> org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema
>> document '
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd',
>> because 1) could not find the document; 2) the document could not be read;
>> 3) the root element of the document is not <xsd:schema>.
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
>> ~[?:?]
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:100)
>> [?:?]
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392)
>> [?:?]
>> ...
>>
>> But I really can't check it today... I'll try tomorrow.
>>
>> regards
>> Grzegorz
>>
>> czw., 17 paź 2024 o 18:24 Luis Lozano <lozanofam...@gmail.com>
>> napisał(a):
>>
>>> No. In karaf 4.2.16 I use 5.15.11, and in 4.4.6 I use 5.17.1
>>>
>>> Do you know of any workarounds to get through this at the moment? I need
>>> the client to test it in their environment before sending a new version.
>>>
>>> El jue, 17 oct 2024 a las 18:13, Grzegorz Grzybek (<gr.grzy...@gmail.com>)
>>> escribió:
>>>
>>>> Hmm
>>>>
>>>> I checked
>>>> org.apache.servicemix.bundles.spring-beans-5.3.33_1.jar/META-INF/spring.schemas
>>>> and it contains proper mapping:
>>>>
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-4.2.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans-4.3.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>> http\://
>>>> www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans.xsd
>>>>
>>>> I don't remember exactly, but I'm pretty sure that at the edge of these
>>>> calls:
>>>>
>>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>>>> [!/:?]
>>>> at
>>>> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)
>>>> [!/:?]
>>>>
>>>> spring-core adds (to xerces / jaxp document builder) proper locator
>>>> that loads the schema not from network, but from the classpath...
>>>>
>>>> Are you using the same version of ActiveMQ in Karaf 4.2.x and 4.4.x?
>>>>
>>>> ~Grzegorz
>>>>
>>>> czw., 17 paź 2024 o 18:02 Luis Lozano <lozanofam...@gmail.com>
>>>> napisał(a):
>>>>
>>>>> Good afternoon.
>>>>> Good afternoon.
>>>>> I have attached a file.
>>>>>
>>>>> 2024-10-16T11:37:36,239 | WARN  | CM Configuration Updater
>>>>> (ManagedServiceFactory Update: factoryPid=[org.apache.activemq.server]) |
>>>>> XmlBeanDefinitionReader          | 346 -
>>>>> org.apache.servicemix.bundles.spring-beans - 5.3.33.1 | Ignored XML
>>>>> validation warning
>>>>> org.xml.sax.SAXParseException: schema_reference.4: Failed to read
>>>>> schema document '
>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd',
>>>>> because 1) could not find the document; 2) the document could not be read;
>>>>> 3) the root element of the document is not <xsd:schema>.
>>>>> at
>>>>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
>>>>> Source) ~[!/:?]
>>>>> at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source)
>>>>> [!/:?]
>>>>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>>>>> [!/:?]
>>>>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>>>>> [!/:?]
>>>>> at
>>>>> org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(Unknown
>>>>> Source) [!/:?]
>>>>>
>>>>> ...
>>>>>
>>>>> Caused by: java.net.UnknownHostException: www.springframework.org
>>>>> at
>>>>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)
>>>>> ~[?:?]
>>>>> at java.net.Socket.connect(Socket.java:609) ~[?:?]
>>>>> at java.net.Socket.connect(Socket.java:558) ~[?:?]
>>>>> at sun.net.NetworkClient.doConnect(NetworkClient.java:182) ~[?:?]
>>>>>
>>>>>
>>>>>
>>>>> Thanx
>>>>>
>>>>> El jue, 17 oct 2024 a las 17:49, Grzegorz Grzybek (<
>>>>> gr.grzy...@gmail.com>) escribió:
>>>>>
>>>>>> Hmm...
>>>>>>
>>>>>> What's the actual stack trace? Is it visible in the log?
>>>>>>
>>>>>> regards
>>>>>> Grzegorz Grzybek
>>>>>>
>>>>>> czw., 17 paź 2024 o 17:41 Luis Lozano <lozanofam...@gmail.com>
>>>>>> napisał(a):
>>>>>>
>>>>>>> Hi.
>>>>>>> "spring-benas-2.0.xsd" is used in the activemq.xml file.
>>>>>>> If I change it to
>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd, the
>>>>>>> error is the same, but now with that last reference name.
>>>>>>> Which reference should I use?
>>>>>>>
>>>>>>> El jue, 17 oct 2024 a las 17:05, Grzegorz Grzybek (<
>>>>>>> gr.grzy...@gmail.com>) escribió:
>>>>>>>
>>>>>>>> Hello
>>>>>>>>
>>>>>>>> "http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";
>>>>>>>> means you have this ancient reference in your application... Normally
>>>>>>>> Spring XMLs should refer to _generic_ XSD without version and these 
>>>>>>>> should
>>>>>>>> be _resolved_ from the jar...
>>>>>>>>
>>>>>>>> Please check if you have this reference in your code.
>>>>>>>>
>>>>>>>> kind regards
>>>>>>>> Grzegorz Grzybek
>>>>>>>>
>>>>>>>> czw., 17 paź 2024 o 14:54 Luis Lozano <lozanofam...@gmail.com>
>>>>>>>> napisał(a):
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hello everyone.
>>>>>>>>>
>>>>>>>>> We have recently migrated from karaf 4.2.16 to karaf 4.4.6
>>>>>>>>> We have our own distribution.
>>>>>>>>> The fact is that everything works fine, except for activemq, which
>>>>>>>>> in the case of installations on servers without internet throws the
>>>>>>>>> following error in kararf.log:
>>>>>>>>> 2024-10-16T11:37:36,239 | WARN | CM Configuration Updater
>>>>>>>>> (ManagedServiceFactory Update: 
>>>>>>>>> factoryPid=[org.apache.activemq.server]) |
>>>>>>>>> XmlBeanDefinitionReader | 346 - 
>>>>>>>>> org.apache.servicemix.bundles.spring-beans
>>>>>>>>> - 5.3.33.1 | Ignored XML validation warning 
>>>>>>>>> org.xml.sax.SAXParseException:
>>>>>>>>> schema_reference.4: Failed to read schema document '
>>>>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd',
>>>>>>>>> because 1) could not find the document; 2) the document could not be 
>>>>>>>>> read;
>>>>>>>>> 3) the root
>>>>>>>>>
>>>>>>>>> ....
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> This makes the activemq broker not work.
>>>>>>>>>
>>>>>>>>> Thanks for the help.--
>>>>>>>>> Saludos:
>>>>>>>>>     Luis Lozano.
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Saludos:
>>>>>>>     Luis Lozano.
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Saludos:
>>>>>     Luis Lozano.
>>>>>
>>>>
>>>
>>> --
>>> Saludos:
>>>     Luis Lozano.
>>>
>>
>
> --
> Saludos:
>     Luis Lozano.
>

Reply via email to