Akka and spring configuration

2019-07-15 00:37发布

I am trying to combine akka with spring (without success). Basically it seems that somehow my application doesn't wont to read akka schema

Part of service-context.xml with schema:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:akka="http://akka.io/schema/akka"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://akka.io/schema/akka http://repo.akka.io/akka-1.3.1.xsd">

Next there are some beans and akka actor definition:

<akka:untyped-actor id="pushManager" autostart="false" implementation="com.myspace.messaging.PushManager"> </akka:untyped-actor>

While running server i receive message:

org.xml.sax.SAXParseException; lineNumber: 55; columnNumber: 143; schema_reference.4: Failed to read schema document 'http://repo.akka.io/akka-1.3.1.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>.

And exception:

Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 55 in XML document from class path resource [service-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 55; columnNumber: 143; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'akka:untyped-actor'.

Schema is located under url: http://repo.akka.io/akka-1.3.1.xsd - I can easily open it inside web browser.

Any clue may help, Thanks Marek.

标签: java spring akka
2条回答
聊天终结者
2楼-- · 2019-07-15 00:54

I've had success using the following for the schemaLocation attribute in my spring beans XML:

http://akka.io/schema/akka http://akka.io/akka-1.3.1.xsd

If you notice in a browser that will cause a download prompt rather than rendering the result, so it may be more compatible with what Spring is looking for.

查看更多
神经病院院长
3楼-- · 2019-07-15 01:07

If you move to the new version of Akka 2.2, the Spring integration package has been removed (you really don't need it). You should implement a UntypedActorFactory, a Creator function or an IndirectActorProducer.

See this blog post for more info; http://blog.nemccarthy.me/?p=272

查看更多
登录 后发表回答