首页 \ 问答 \ org.apache.cxf.interceptor.Fault:编组错误:ELEMENT_NAME_MISMATCH(org.apache.cxf.interceptor.Fault: Marshalling Error: ELEMENT_NAME_MISMATCH)

org.apache.cxf.interceptor.Fault:编组错误:ELEMENT_NAME_MISMATCH(org.apache.cxf.interceptor.Fault: Marshalling Error: ELEMENT_NAME_MISMATCH)

我是apache cxf的新手。 我正在使用一个cxf拦截器拦截我的肥皂响应并发送一个自定义的故障代码。 一切正常,当我尝试从肥皂用户界面。 但是当我运行测试时,我得到了正确的响应,之后出现由于测试失败导致的此错误“ org.apache.cxf.interceptor.Fault:编组错误:ELEMENT_NAME_MISMATCH ”。

错误 (奇怪的是我在得到这个错误之前得到肥皂响应)

   2016-11-28 21:49:16.371  WARN 8756 --- [main]          o.a.cxf.phase.PhaseInterceptorChain      : Interceptor for  {subscriptionservice/}SubscriptionServiceService#{subscriptionservice/}createSubscriptionEntity has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: Marshalling Error: ELEMENT_NAME_MISMATCH
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(JAXBEncoderDecoder.java:605)
    at   org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:663)
    at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179)
    at org.apache.cxf.interceptor.ClientFaultConverter.processFaultDetail(ClientFaultConverter.java:155)
    at org.apache.cxf.interceptor.ClientFaultConverter.handleMessage(ClientFaultConverter.java:82)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:112)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
    at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
    at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    at com.sun.proxy.$Proxy215.createSubscriptionEntity(Unknown Source)
    at tests.SubscriptionTests.dCreateSubscriptionWithNullValuesTSU08(SubscriptionTests.java:319)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.cxf.interceptor.Fault: ELEMENT_NAME_MISMATCH
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(JAXBEncoderDecoder.java:512)
    ... 58 common frames omitted

I am new to apache cxf. I was using a cxf Interceptor to intercept my soap response and send a custom fault mesaage. Everything works fine when i try from Soap UI. But when i run tests , i get the correct response followed by this error "org.apache.cxf.interceptor.Fault: Marshalling Error: ELEMENT_NAME_MISMATCH" due to which tests failed.

Error (The Weird thing is i get the soap response back before this error gets thrown)

   2016-11-28 21:49:16.371  WARN 8756 --- [main]          o.a.cxf.phase.PhaseInterceptorChain      : Interceptor for  {subscriptionservice/}SubscriptionServiceService#{subscriptionservice/}createSubscriptionEntity has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: Marshalling Error: ELEMENT_NAME_MISMATCH
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(JAXBEncoderDecoder.java:605)
    at   org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:663)
    at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179)
    at org.apache.cxf.interceptor.ClientFaultConverter.processFaultDetail(ClientFaultConverter.java:155)
    at org.apache.cxf.interceptor.ClientFaultConverter.handleMessage(ClientFaultConverter.java:82)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:112)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
    at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
    at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    at com.sun.proxy.$Proxy215.createSubscriptionEntity(Unknown Source)
    at tests.SubscriptionTests.dCreateSubscriptionWithNullValuesTSU08(SubscriptionTests.java:319)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.cxf.interceptor.Fault: ELEMENT_NAME_MISMATCH
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(JAXBEncoderDecoder.java:512)
    ... 58 common frames omitted

原文:https://stackoverflow.com/questions/40850715
更新时间:2023-08-26 15:08

最满意答案

这可能是因为你的other没有rb2D组件,只有你的游戏对象附加了这个脚本。

other一种是Collider2D类型,它不包含你的刚体定义rb2d

我相信你的代码应该是:

other.velocity = Vector2.zero;
other.AddForce(Vector2.up * jumpHeight, ForceMode2D.Impulse);`

注意 - 我不认为velocity也是Collider2D一部分 - 请查看这里的文档。


It could be because your other doesn't have a rb2D component on it, only your game object that this script is attached on.

other is a Collider2D type, which does not contain your rigidbody definition rb2d

I believe your code should be:

other.velocity = Vector2.zero;
other.AddForce(Vector2.up * jumpHeight, ForceMode2D.Impulse);`

Note - I don't think velocity is part of Collider2D either - check out the docs here.

相关问答

更多
  • 好吧,我做到了:),只好使用other.transform.parent.GetComponent(); 就像Nika Kasradze说的那样,然后我必须在做任何事情之前测试玩家是否为空:) 谢谢你的帮助 ! using Devdog.General; using System.Collections; using System.Collections.Generic; using UnityEngine; public class SafeZone : MonoBehaviour { pro ...
  • 这可能是因为你的other没有rb2D组件,只有你的游戏对象附加了这个脚本。 other一种是Collider2D类型,它不包含你的刚体定义rb2d 我相信你的代码应该是: other.velocity = Vector2.zero; other.AddForce(Vector2.up * jumpHeight, ForceMode2D.Impulse);` 注意 - 我不认为velocity也是Collider2D一部分 - 请查看这里的文档。 It could be because your othe ...
  • 这不是如何移动Rigidbody对象并移动它可能会导致许多问题,包括您的问题中提到的问题。 具有Rigidbody对象应该使用Rigidbody组件和Rigidbody.MovePosition , Rigidbody.AddForce和Rigidbody.velocity等函数移动,而不是通过transform或transform.Translate 。 此外,您应该在FixedUpdate函数中移动Rigidbody对象而不是Update函数。 如果你正在通过变换移动其他Rigidbody对象,那么你也 ...
  • 似乎RigidBody组件属于球。 使用-rigidbody.velocity您将尝试访问触发器的速度。 请尝试使用Ball.rigidbody.velocity 。 顺便说一句,我认为您可以简单地将angularVelocity的velocity和angularVelocity设置为零,而不是RigidBody施加力。 It seems that the RigidBody component belongs to the ball. With -rigidbody.velocity you are tr ...
  • 你可以使用动画事件在剑上升动画时使其成为布尔值,在剑落下时将其变为假,并在调用OnTriggerEnter时检查布尔值 创建一个像hit这样的变量,通过动画事件将其设置为true和false public bool hit; void OnTriggerEnter(Collider col) { if (hit){ if (col.GetComponent().tag == "enemy"){ ...
  • 您可能在碰撞的对象层次结构中有多个碰撞器。 看一下这个基于图层的碰撞检测文档 。 它解释了如何在一个层中仅创建一个碰撞器,并使所有碰撞仅在该特定层中发生,从而仅激活该单个碰撞器。 You probably have more than one collider in the collided object hierarchy. Take a look at this Layer-Based Collision Detection document. It explains how you can creat ...
  • 您需要在更新循环中执行GetKeyUp并设置一个布尔标志,然后在OnTriggerEnter中进行检查。 或者反之亦然,具体取决于您的时序要求(即在OnTriggerEnter中设置布尔标志,并在Update循环中检查它)。 [根据你的描述,我可能会这样做] 您遇到的问题是OnTriggerEnter只会触发一次,因此它不会继续轮询键盘以查看键状态的变化,这就是您需要在Update循环中进行检查的原因。 You will need to do the GetKeyUp in the update loop ...
  • 你不必那样做。 Destroy函数可以将第二个参数作为销毁Object之前的延迟时间。 Destroy(trig.gameObject, 1f); 如果您仍想使用协同程序执行此操作,只需使用BowlDestroyTime函数将BowlDestroyTime作为参数,然后将OnTriggerEnter2D从OnTriggerEnter2D函数传递到BowlDestroyTime函数以进行销毁。 void OnTriggerEnter2D(Collider2D trig) { if (trig.gam ...
  • 球体是玩家的儿童GameObject,还是GameObject本身? 您可能想要检查脚本的附加位置。 如果脚本附加到播放器但是对象位于子GameObject上,那就不太适用了。 对撞机和脚本需要在同一个GameObject上。 Is the sphere a child GameObject to the player, or is it the GameObject itself? You might want to check where the script is attached. If the s ...
  • 在Snake_Body的盒子对撞机上勾选“触发器”。 如果没有这个,就不会调用OnTriggerEnter2D函数。 您已在边框对撞机上正确完成此操作。 Tick 'is Trigger' on the Snake_Body's box collider. Without this the OnTriggerEnter2D function is not called. You have done this correctly on the border box collider.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)