0

一直在将我们的 Glassfish 应用程序从 scala 2.9 升级到 2.10,我看到 JAXB 试图将私有 [this] 方法导出为 Web 服务的一部分。

例如,这是一个方法签名,它甚至没有注释。

  private[this] def createFreeSubscription(user: User, plan: Plan): Option[UpdateResponseDO] = {}

2.10 中是否有更改让 JAXB 认为这不应该被隐藏?

这是错误。

[#|2013-04-22T20:46:39.186-0600|SEVERE|glassfish3.1.2|javax.enterprise.webservices.org.glassfish.webservices|_ThreadID=112;_ThreadName=Thread-7;|Cannot initialize endpoint  : error is : 
com.sun.xml.ws.spi.db.DatabindingException: java.lang.RuntimeException: This version of JAXB might not be supported: proxy object creation failed, probably due to failing constructor method
    at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:101)
    at com.sun.xml.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:182)
    at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:213)
    at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:186)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:186)
    at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:111)
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:318)
    at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:99)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
    at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:130)
    at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:433)
    at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:268)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:145)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:569)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:552)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:623)
    at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:271)
    at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:116)
    at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:91)
    at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
    at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:131)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
    at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
    at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
    at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:384)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: This version of JAXB might not be supported: proxy object creation failed, probably due to failing constructor method
    at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxy.createProxy(JaxbContextProxy.java:55)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
    at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111)
    at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:113)
    at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:89)
    ... 45 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedConstructorAccessor120.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextFactory.buildContext(JaxbContextFactory.java:31)
    at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxyHandler.buildContext(JaxbContextProxyHandler.java:133)
    at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxyHandler.<init>(JaxbContextProxyHandler.java:103)
    at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxy.createProxy(JaxbContextProxy.java:46)
    ... 50 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
scala.collection.Seq is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at scala.collection.Seq
        at public final scala.collection.Seq scala.util.matching.Regex.scala$util$matching$Regex$$groupNames
        at scala.util.matching.Regex
        at public scala.util.matching.Regex com.gaiam.gcsi.ws.jaxws.CouponRegexResponse._return
        at com.gaiam.gcsi.ws.jaxws.CouponRegexResponse
com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus
        at public com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$statusToAuthCode.arg0
        at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$statusToAuthCode
Two classes have the same XML type name "{http://gaiam.com/gcsi}option". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at scala.Option
        at public scala.Option com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$getPurchasingOptionsResponse._return
        at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$getPurchasingOptionsResponse
    this problem is related to the following location:
        at fj.data.Option
        at public fj.data.Option com.gaiam.gcsi.entities.user.User.getEmail()
        at com.gaiam.gcsi.entities.user.User
        at public com.gaiam.gcsi.entities.user.User com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$createFreeSubscription.arg0
        at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$createFreeSubscription
Two classes have the same XML type name "{http://gaiam.com/gcsi}state". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at com.gaiam.gcsi.entities.order.Order$State
        at public com.gaiam.gcsi.entities.order.Order$State com.gaiam.gcsis.ws.dto.OrderInfoDO.getOrderState()
        at com.gaiam.gcsis.ws.dto.OrderInfoDO
        at public com.gaiam.gcsis.ws.dto.OrderInfoDO com.gaiam.gcsi.ws.jaxws.GetOrderInfoResponse.orderInfo
        at com.gaiam.gcsi.ws.jaxws.GetOrderInfoResponse
    this problem is related to the following location:
        at com.gaiam.gcsi.entities.user.PaymentSource$State
        at public com.gaiam.gcsi.entities.user.PaymentSource$State com.gaiam.gcsi.entities.user.PaymentSource.getState()
        at com.gaiam.gcsi.entities.user.PaymentSource
        at com.gaiam.gcsi.entities.user.CreditCard
        at public com.gaiam.gcsi.entities.user.CreditCard com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$guessBillingAddress.arg0
        at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$guessBillingAddress

    at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
    ... 57 more
4

1 回答 1

0

用于@XmlTransient从映射中排除字段、方法或类。

于 2013-04-26T15:12:41.673 回答