简体   繁体   English

JMS消息,由于缺少@XmlRootElement批注,因此无法将类型“ java.lang.String”作为元素封送

[英]JMS message, unable to marshal type “java.lang.String” as an element because it is missing an @XmlRootElement annotation

I have an unexplainable problem that just cropped up. 我有一个无法解释的问题。 In production a RedHat webserver OS was updated/patched and when it restarted, our spring jms application suddenly stopped working. 在生产中,RedHat Web服务器操作系统已更新/打补丁,并且在重新启动时,我们的spring jms应用程序突然停止工作。 No code has changed. 没有代码已更改。

Here is the error message : 这是错误消息:

javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation]
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
        at ca.mycompany.middleware.data.serializer.JAXBSerializer.serialize(JAXBSerializer.java:30)

...

 Caused by: com.sun.istack.SAXException2: unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation
        at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:248)
        at com.sun.xml.bind.v2.runtime.LeafBeanInfoImpl.serializeRoot(LeafBeanInfoImpl.java:137)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
        ... 15 more

I don't understand what the problem is ? 我不明白是什么问题?

UPDATE: 更新:

I found the problem. 我发现了问题。 When I started stepping through the code, I found that the real root of the problem was that my application was being blocked by this exception : 当我开始单步执行代码时,我发现问题的真正根源是此异常阻止了我的应用程序:

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? javax.net.ssl.SSLException:无法识别的SSL消息,纯文本连接?

I have a work-around, but I'm trying to figure out what changed to block the way I used to call the webservice. 我有一个解决方法,但是我试图找出更改后的内容以阻止我以前调用Web服务的方式。

So, was your java version upgraded? 那么,您的Java版本是否已升级? It seems like in this area of your code: 似乎在代码的这一部分:

at ca.mycompany.middleware.data.serializer.JAXBSerializer.serialize(JAXBSerializer.java:30)

you're trying to JAXB Serialize a string. 您正在尝试JAXB序列化字符串。 This isn't allowed. 这是不允许的。 I wouldn't be surprised if it was a bug in older versions. 如果它是旧版本中的错误,我不会感到惊讶。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将类型“java.lang.Integer”编组为元素,因为它缺少 @XmlRootElement 注释 - unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation 无法将类型 [...] 编组为元素,因为它缺少 @XmlRootElement 注释 - unable to marshal type […] as an element because it is missing an @XmlRootElement annotation 无法将类型编组为XML元素,因为缺少@XmlRootElement注释 - Unable to marshal type as XML element because @XmlRootElement annotation is missing 无法将类型编组为元素,因为它缺少自动生成的类的 @XmlRootElement 注释 - unable to marshal type as an element because it is missing an @XmlRootElement annotation for auto generated classes 我有@xmlrootelement,但一直收到此异常:无法将类型编组为元素,因为它缺少@XmlRootElement - I have @xmlrootelement , but keep getting this exception: unable to marshal type as an element because it is missing an @XmlRootElement JAXB,Marshal的问题-无法封送类型“ java.lang.String” - Problems with JAXB, Marshal, - unable to marshal type “java.lang.String” JAXB,Marshal的问题, - 无法编组类型“java.lang.String” - Problems with JAXB, Marshal, - unable to marshal type “java.lang.String” 带有自定义JAX-B绑定的JAX-WS MarshalException:无法将类型“java.lang.String”编组为元素 - JAX-WS MarshalException with custom JAX-B bindings: Unable to marshal type “java.lang.String” as an element 存在@XmlRootElement批注时,无法封送Java类 - Unable to marshal Java class when @XmlRootElement annotation is present 不能Marshal java.lang.String - Can't Marshal java.lang.String
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM