找不到 XMPP Spring 集成 属性 或字段 'json'
XMPP Spring Integration Property or field 'json' cannot be found
我尝试使用以下教程通过 Spring 集成实现 XMPP:
https://grokonez.com/spring-framework/spring-integration/firebase-cloud-messaging-xmpp-server-example-receive-upstream-messages-spring-integration
但是我收到以下错误:
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'json' cannot be found on object of type 'org.jivesoftware.smack.packet.StandardExtensionElement' - maybe not public or not valid?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:217) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:104) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.access[=13=]0(PropertyOrFieldReference.java:51) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:406) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:90) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:111) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:328) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint$ChatMessagePublishingStanzaListener.processStanza(ChatMessageListeningEndpoint.java:143) ~[spring-integration-xmpp-5.1.1.RELEASE.jar:5.1.1.RELEASE]
那么如何在 Spring 集成中接收上游消息?
你的问题是你没有显示你的代码是什么。看起来你真的错过了一个事实,即提到的样本是基于 GCM,其中 org.jivesoftware.smack.packet.Message
中的 getExtension('google:mobile:data')
对我们来说真的 returns org.jivesoftware.smackx.gcm.packet.GcmPacketExtension
与 getJson()
方法。
在你的情况下,你得到的似乎是 org.jivesoftware.smack.packet.StandardExtensionElement
。所以,那真的是意料之中没有json
那边。
我尝试使用以下教程通过 Spring 集成实现 XMPP: https://grokonez.com/spring-framework/spring-integration/firebase-cloud-messaging-xmpp-server-example-receive-upstream-messages-spring-integration
但是我收到以下错误:
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'json' cannot be found on object of type 'org.jivesoftware.smack.packet.StandardExtensionElement' - maybe not public or not valid?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:217) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:104) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.access[=13=]0(PropertyOrFieldReference.java:51) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:406) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:90) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:111) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:328) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint$ChatMessagePublishingStanzaListener.processStanza(ChatMessageListeningEndpoint.java:143) ~[spring-integration-xmpp-5.1.1.RELEASE.jar:5.1.1.RELEASE]
那么如何在 Spring 集成中接收上游消息?
你的问题是你没有显示你的代码是什么。看起来你真的错过了一个事实,即提到的样本是基于 GCM,其中 org.jivesoftware.smack.packet.Message
中的 getExtension('google:mobile:data')
对我们来说真的 returns org.jivesoftware.smackx.gcm.packet.GcmPacketExtension
与 getJson()
方法。
在你的情况下,你得到的似乎是 org.jivesoftware.smack.packet.StandardExtensionElement
。所以,那真的是意料之中没有json
那边。