Been upgrading our Glassfish app from scala 2.9 to 2.10 and I'm seeing JAXB trying to export private[this] methods as part of the web service.
For instance, here is a method signature, it's not even annotated.
private[this] def createFreeSubscription(user: User, plan: Plan): Option[UpdateResponseDO] = {}
Is there a change in 2.10 that would allow JAXB to think this should not be hidden?
Here is the error.
[#|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
Use #XmlTransient to exclude fields, methods or classes from mapping.
Related
I have created a Schedule Gantt chart using Oracle ADF technology. I am trying to specify and show non-working days in a different color based on Oracle's instructions.
The problem is that when I specify non-working days using the backing bean below method:
public int[] getNonWorkingDaysOfWeek(){
return new int[] {Calendar.SATURDAY, Calendar.SUNDAY};
}
and
I face below error when loading the page:
The content of this page failed to load as expected because data transmission was interrupted. Please try again, or contact your system administrator.
When I specify sun in the NonWorkingDaysOfWeek property, then the page loads the error:
Error 500--Internal Server Error
javax.el.ELException: //C:/Users/Waseem Abbas/AppData/Roaming/JDeveloper/system12.2.1.0.42.170105.1157/o.j2ee/drs/SchedulGantt/ViewControllerWebApp.war/taskflow/pages/GanttSchudule.jsf #36,77 nonWorkingDaysOfWeek="sun": java.lang.IllegalArgumentException: Cannot convert sun of type class java.lang.String to class [I
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at oracle.adfinternal.view.faces.bi.taglib.gantt.BaseGanttTag.setDaysOfWeekHelper(BaseGanttTag.java:683)
at oracle.adfinternal.view.faces.bi.facelets.gantt.rules.GanttRule$NonWorkingDaysOfWeekMetaData.applyMetadata(GanttRule.java:102)
at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:491)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:178)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:202)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:202)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at com.sun.faces.facelets.tag.jsf.core.FacetHandler.apply(FacetHandler.java:104)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:202)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:202)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at oracle.adfinternal.view.faces.facelets.rich.RichDocumentHandler.applyNextHandler(RichDocumentHandler.java:68)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:202)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:225)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:1006)
at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)
at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)
at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.buildView(ViewDeclarationLanguageFactoryImpl.java:322)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager._processViewDefinitionLanguage(ResponseRenderManager.java:105)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager.runRenderView(ResponseRenderManager.java:41)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1228)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executeRenderResponse(LifecycleImpl.java:1040)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:332)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:254)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:651)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:194)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:105)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:529)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:529)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:354)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:232)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:141)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:649)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:124)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:232)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:94)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:224)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3654)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert sun of type class java.lang.String to class [I
at com.sun.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:87)
at javax.el.ELContext.convertToType(ELContext.java:478)
at com.sun.el.lang.EvaluationContext.convertToType(EvaluationContext.java:166)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:229)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 90 more
Caused by: java.lang.IllegalArgumentException: Cannot convert sun of type class java.lang.String to class [I
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:428)
at com.sun.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:85)
... 94 more
I am using JDeveloper IDE Version, Oracle IDE 12.2.1.0.42.170105.1157.
I am trying to return a Clojure PersistentVector from a Spring Boot RestController method:
#GetMapping("example")
public PersistentVector someVector() {
return PersistentVector.create(42, "hello");
}
However, it appears Spring Boot is treating the PersistentVector as a function (it is a subtype of Runnable and Callable):
clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector
at clojure.lang.AFn.throwArity(AFn.java:429) ~[clojure-1.9.0.jar:na]
at clojure.lang.AFn.invoke(AFn.java:28) ~[clojure-1.9.0.jar:na]
at clojure.lang.AFn.call(AFn.java:18) ~[clojure-1.9.0.jar:na]
at org.springframework.web.context.request.async.WebAsyncManager.lambda$startCallableProcessing$4(WebAsyncManager.java:323) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_181]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_181]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
How do I tell Spring Boot to treat the PersistentVector as a List instead (it is also a subtype of List)?
The confusion between list and function can be solved by explicitly calling .iterator() on the vector:
#GetMapping("example")
public Iterator someVector() {
// ~~~~~~~~
return PersistentVector.create(42, "hello").iterator();
} // ~~~~~~~~~~~
Maybe not the cleanest solution, but hey, it gets the job done!
PersistentVector implements transitively Iterable and List.
#GetMapping("example")
public List someVector() {
return PersistentVector.create(42, "hello");
}
Implicitly down-casting the return value should do the trick as well.
I am trying to use DI to inject a webservice client in my application. I get runtime exception as i refer current application in the object being injected. Below is the skeletal of my code.
**import play.api.Play.Current**
#Singleton
class MicorServiceClient#Inject()(ws: WSclient) {
// References curret.configuraiton.getString(
....
}
class Application #Inject()(microServiceClient: MicorServiceClient) extends Controller {
def someMethod= Action {
//Calls the micorservicelient.getResponse()
}
}
I see following error when my api is called.
#709lj5bmd: Unexpected exception
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:170)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
at scala.Option.map(Option.scala:146)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
at scala.util.Success.flatMap(Try.scala:231)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.RuntimeException: There is no started application
Ah, solved the issue, i need to pass play.api.Configuration to the Client and remove the references to current
so my MicroServiceClient definition looks like below
class MicroServiceClient(ws: WSclient, configuration: play.api.Configuration) {
}
I am building a Play Scala project and need an authentication for the apps.
I am using this one : https://github.com/nulab/scala-oauth2-provider as the Oauth Provider libs.
I have implement everything based on the docs. But when implement the Auth on the controller below :
object Token extends MainController with OAuth2Provider {
def accessToken = Action.async { implicit request =>
issueAccessToken(new MyDataHandler()
}
And here my router :
GET /test controllers.Token.test
POST /token controllers.Token.accessToken
When I access localhost/token, i got this error :
And here the error from console :
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.IncompatibleClassChangeError: Found interface play.api.mvc.Headers, but class was expected]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.10-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.10-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:145) [scala-library-2.10.5.jar:na]
Caused by: java.lang.RuntimeException: java.lang.IncompatibleClassChangeError: Found interface play.api.mvc.Headers, but class was expected
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:523) ~[play_2.10-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.10-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.10-2.3.7.jar:2.3.7]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.10-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) ~[play_2.10-2.3.7.jar:2.3.7]
Caused by: java.lang.IncompatibleClassChangeError: Found interface play.api.mvc.Headers, but class was expected
at scalaoauth2.provider.OAuth2BaseProvider$class.play2oauthRequest(OAuth2Provider.scala:24) ~[play2-oauth2-provider_2.10-0.15.1.jar:0.15.1]
at controllers.Token$.play2oauthRequest(Token.scala:14) ~[na:na]
at scalaoauth2.provider.OAuth2Provider$class.issueAccessToken(OAuth2Provider.scala:138) ~[play2-oauth2-provider_2.10-0.15.1.jar:0.15.1]
at controllers.Token$.issueAccessToken(Token.scala:14) ~[na:na]
at controllers.Token$$anonfun$accessToken$1.apply(Token.scala:25) ~[na:na]
I have implement everything what does docs said. Sorry I am actually new on Scala and on the Play it self.
What do you use Play and scala-oauth2-provider version?
The error looks Play version is different.
If you use Play 2.3, you should use 0.14.0 in scala-oauth2-provider.
See readme.
I hope you can help me with this:
I have a WebProject created with Eclipse as a dynamic web project, running on a Glassfish3 Server. I’m using EJB 3.0 to create a stateless Façade(#stateless Annotation) that implements my business logic:
#Stateless
public class Facade {
public void test(){
System.out.println("test hat geklappt!!");
}
}
Additionally I’m using a RESTRessource to offer my REST WS that uses my EJB with (#EJB Annotation) the business logic:
#RequestScoped
#Path("/prescriptions")
public class Ressource {
#EJB
private Facade facade;
public Ressource() {
super();
}
#GET
#Path("/user/{userid}")
#Produces(MediaType.APPLICATION_JSON)
public void getUser(#PathParam("userid") String userid) {
facade.test();
}
}
Although I can get into the REST WS and call it, my EJB is always null and I cant find a reason why.
I would really appreciate it if you could help me. In case you need more information about the code or something just ask.
Thanks in advance,
Florian
PS: I always get the following error in my log:
INFO: Portable JNDI names for EJB Facade : [java:global/TestProject/Facade,java:global/TestProject/Facade!webservices.Facade]
INFO: Portable JNDI names for EJB Facade : [java:global/TestProject/Facade, java:global/TestProject/Facade!webservices.Facade]
INFO: Scanning for root resource and provider classes in the packages:
webservices
INFO: Root resource classes found:
class webservices.Ressource
INFO: No provider classes found.
INFO: Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'
SCHWERWIEGEND: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NullPointerException
at webservices.Ressource.getUser(Ressource.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$VoidOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:150)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1347)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1279)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1219)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
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:662)
Ideally RESTFul class design should be stateless, as explained in this article:
A stateless service not only performs better, it shifts most of the
responsibility of maintaining state to the client application
If you add the Stateless annotation to your Ressource class, you can inject your Facade session bean, and the container will care of the lifecycle of your session bean.
This will make your code run smoothly without the exception.
Don't forget to make your getUser method return a value!
public String getUser(#PathParam("userid") String userid) {
facade.test();
return "{" + userid + "}";
}