calling rest service from postconstruct in managed bean

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

calling rest service from postconstruct in managed bean

MarkD
Hi,

I have a managed bean and I am trying to initialize some properties through
a postconstruct method, which utilises a service that makes a rest call to
get the data. When running a test on the bean using Arquillian and Wiremock
to mock the rest call, I have the error below. Any ideas? I am assuming that
the connection is not ready? If I place the service making the rest call
into one of the bean methods, then all works fine. I am using Tomee 7.0.3

Thanks for any help.



WARNING: Interceptor for {http://localhost:8080}WebClient has thrown
exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at
org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:674)
        at
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1034)
        at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:892)
        at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
        at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
        at
org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1547)
        at
org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1542)
        at
org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.get(WebClient.java:1462)
        at
org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.get(InvocationBuilderImpl.java:80)
        at
com.mark.apps.cms.port.adapter.service.HttpGetEnquiriesAdapter.getEnquiries(HttpGetEnquiriesAdapter.java:38)
        at
com.mark.apps.cms.port.adapter.service.TranslatingGetEnquiriesService.getEnquires(TranslatingGetEnquiriesService.java:23)
        at
com.mark.apps.cms.backing.EnquiriesBacking.initialize(EnquiriesBacking.java:30)
        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:498)
        at
org.apache.webbeans.intercept.LifecycleInterceptorInvocationContext.proceed(LifecycleInterceptorInvocationContext.java:103)
        at
org.apache.webbeans.portable.InjectionTargetImpl.postConstruct(InjectionTargetImpl.java:313)
        at
org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:127)
        at org.apache.webbeans.component.ManagedBean.create(ManagedBean.java:67)
        at
org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
        at
org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
        at
org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:799)
        at
org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:659)
        at
org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:103)
        at
org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
        at
org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
        at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
        at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
        at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:56)
        at
org.apache.openejb.arquillian.common.enrichment.OpenEJBEnricher.doInject(OpenEJBEnricher.java:131)
        at
org.apache.openejb.arquillian.common.enrichment.OpenEJBEnricher.enrich(OpenEJBEnricher.java:100)
        at
org.apache.openejb.arquillian.common.TomEEInjectionEnricher.enrich(TomEEInjectionEnricher.java:52)
        at
org.jboss.arquillian.junit.RulesEnricher.enrichInstances(RulesEnricher.java:94)
        at
org.jboss.arquillian.junit.RulesEnricher.enrichRulesAndTestInstance(RulesEnricher.java:69)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
        at
org.apache.openejb.arquillian.common.TestObserver.switchLoader(TestObserver.java:87)
        at
org.apache.openejb.arquillian.common.TestObserver.observesTest(TestObserver.java:67)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
        at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
        at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)
        at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:303)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        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.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:205)
        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.net.ConnectException: ConnectException invoking
<a href="http://localhost:8080:">http://localhost:8080: Connection refused (Connection refused)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1369)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653)
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        ... 102 more
Caused by: java.net.ConnectException: Connection refused (Connection
refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
        at sun.net.www.http.HttpClient.New(HttpClient.java:339)
        at sun.net.www.http.HttpClient.New(HttpClient.java:357)
        at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
        at
sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
        at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
        at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at
org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:353)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1586)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1615)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1559)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
        ... 105 more

javax.ws.rs.ProcessingException: java.net.ConnectException: ConnectException
invoking <a href="http://localhost:8080:">http://localhost:8080: Connection refused (Connection refused)
Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.2.13.v20150730
Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.handler.ContextHandler
doStart
INFO: Started
o.e.j.s.ServletContextHandler@29612ee2{/__admin,null,AVAILABLE}
Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.handler.ContextHandler
doStart
INFO: Started o.e.j.s.ServletContextHandler@47a90d2a{/,null,AVAILABLE}
Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started ServerConnector@61756f03{HTTP/1.1}{0.0.0.0:8080}
Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.Server doStart
INFO: Started @401670ms
Sep 14, 2017 10:33:01 AM
org.eclipse.jetty.server.handler.ContextHandler$Context log
INFO: RequestHandlerClass from context returned
com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped
under returned 'null'
Sep 14, 2017 10:33:02 AM
com.github.tomakehurst.wiremock.common.Slf4jNotifier error
SEVERE: Request was not matched:
{
  "url" : "/",
  "absoluteUrl" : "http://localhost:8080/",
  "method" : "GET",
  "clientIp" : "127.0.0.1",
  "headers" : {
    "User-Agent" : "Apache-CXF/3.1.10",
    "Connection" : "keep-alive",
    "Host" : "localhost:8080",
    "Pragma" : "no-cache",
    "Accept" : "*/*",
    "Cache-Control" : "no-cache"
  },
  "cookies" : { },
  "browserProxyRequest" : false,
  "loggedDate" : 1505381581605,
  "bodyAsBase64" : "",
  "body" : "",
  "loggedDateString" : "2017-09-14T09:33:01Z"
}
Sep 14, 2017 10:33:04 AM
org.eclipse.jetty.server.handler.ContextHandler$Context log
INFO: RequestHandlerClass from context returned
com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped
under returned 'null'
Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.AbstractConnector doStop
INFO: Stopped ServerConnector@61756f03{HTTP/1.1}{0.0.0.0:8080}
Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.handler.ContextHandler
doStop
INFO: Stopped o.e.j.s.ServletContextHandler@47a90d2a{/,null,UNAVAILABLE}
Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.handler.ContextHandler
doStop
INFO: Stopped
o.e.j.s.ServletContextHandler@29612ee2{/__admin,null,UNAVAILABLE}

com.github.tomakehurst.wiremock.client.VerificationException: A request was
unmatched by any stub mapping. Closest stub mapping was:   <Click to see
difference>


        at
com.github.tomakehurst.wiremock.client.VerificationException.forSingleUnmatchedRequest(VerificationException.java:43)
        at
com.github.tomakehurst.wiremock.client.VerificationException.forUnmatchedRequests(VerificationException.java:48)
        at
com.github.tomakehurst.wiremock.junit.WireMockRule.checkForUnmatchedRequests(WireMockRule.java:87)
        at
com.github.tomakehurst.wiremock.junit.WireMockRule.access$000(WireMockRule.java:33)
        at
com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:73)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:324)
        at
org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.execute(ClientBeforeAfterLifecycleEventExecuter.java:99)
        at
org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.on(ClientBeforeAfterLifecycleEventExecuter.java:72)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
        at
org.apache.openejb.arquillian.common.TestObserver.switchLoader(TestObserver.java:87)
        at
org.apache.openejb.arquillian.common.TestObserver.observesTest(TestObserver.java:67)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
        at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
        at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
        at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)
        at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:317)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        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.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:205)
        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Sep 14, 2017 10:33:08 AM org.apache.openejb.assembler.classic.Assembler
destroyApplication
INFO: Undeploying app:
/home/mark/Documents/dev/mark/apps/cms/target/working-dir/0/com.mark.apps.cms.backing.EnquiriesBackingTest
Sep 14, 2017 10:33:08 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-20002"]
Sep 14, 2017 10:33:08 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-20002"]
Sep 14, 2017 10:33:08 AM org.apache.catalina.core.StandardService
stopInternal
INFO: Stopping service Tomcat
Sep 14, 2017 10:33:09 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-20002"]



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
Reply | Threaded
Open this post in threaded view
|

Re: calling rest service from postconstruct in managed bean

chongma
are you using JSF?  if so have you tried using the below in the xhtml:
<f:metadata>
     <f:viewParam name="id" value="#{myBean.id}" />
     <f:viewAction action="#{myBean.onload}" />
</f:metadata>
you can call a bean method (e.g. myBean.onload) then you don't need
@PostConstruct.  you can also pass parameters if you have a setter on
the @ManagedBean.  also consider switching to from EJB @ManagedBean to
CDI @Named

On 14/09/2017 11:43, MarkD wrote:

> Hi,
>
> I have a managed bean and I am trying to initialize some properties through
> a postconstruct method, which utilises a service that makes a rest call to
> get the data. When running a test on the bean using Arquillian and Wiremock
> to mock the rest call, I have the error below. Any ideas? I am assuming that
> the connection is not ready? If I place the service making the rest call
> into one of the bean methods, then all works fine. I am using Tomee 7.0.3
>
> Thanks for any help.
>
>
>
> WARNING: Interceptor for {http://localhost:8080}WebClient has thrown
> exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> at
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:674)
> at
> org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1034)
> at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:892)
> at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
> at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
> at
> org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1547)
> at
> org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1542)
> at
> org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.get(WebClient.java:1462)
> at
> org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.get(InvocationBuilderImpl.java:80)
> at
> com.mark.apps.cms.port.adapter.service.HttpGetEnquiriesAdapter.getEnquiries(HttpGetEnquiriesAdapter.java:38)
> at
> com.mark.apps.cms.port.adapter.service.TranslatingGetEnquiriesService.getEnquires(TranslatingGetEnquiriesService.java:23)
> at
> com.mark.apps.cms.backing.EnquiriesBacking.initialize(EnquiriesBacking.java:30)
> 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:498)
> at
> org.apache.webbeans.intercept.LifecycleInterceptorInvocationContext.proceed(LifecycleInterceptorInvocationContext.java:103)
> at
> org.apache.webbeans.portable.InjectionTargetImpl.postConstruct(InjectionTargetImpl.java:313)
> at
> org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:127)
> at org.apache.webbeans.component.ManagedBean.create(ManagedBean.java:67)
> at
> org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
> at
> org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
> at
> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:799)
> at
> org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:659)
> at
> org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:103)
> at
> org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
> at
> org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
> at
> org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
> at
> org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
> at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:56)
> at
> org.apache.openejb.arquillian.common.enrichment.OpenEJBEnricher.doInject(OpenEJBEnricher.java:131)
> at
> org.apache.openejb.arquillian.common.enrichment.OpenEJBEnricher.enrich(OpenEJBEnricher.java:100)
> at
> org.apache.openejb.arquillian.common.TomEEInjectionEnricher.enrich(TomEEInjectionEnricher.java:52)
> at
> org.jboss.arquillian.junit.RulesEnricher.enrichInstances(RulesEnricher.java:94)
> at
> org.jboss.arquillian.junit.RulesEnricher.enrichRulesAndTestInstance(RulesEnricher.java:69)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
> at
> org.apache.openejb.arquillian.common.TestObserver.switchLoader(TestObserver.java:87)
> at
> org.apache.openejb.arquillian.common.TestObserver.observesTest(TestObserver.java:67)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
> at
> org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
> at
> org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)
> at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:303)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 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.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:205)
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at
> com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
> at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
> at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
> Caused by: java.net.ConnectException: ConnectException invoking
> <a href="http://localhost:8080:">http://localhost:8080: Connection refused (Connection refused)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1369)
> at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> ... 102 more
> Caused by: java.net.ConnectException: Connection refused (Connection
> refused)
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at
> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
> at
> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
> at
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
> at java.net.Socket.connect(Socket.java:589)
> at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
> at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
> at sun.net.www.http.HttpClient.New(HttpClient.java:339)
> at sun.net.www.http.HttpClient.New(HttpClient.java:357)
> at
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
> at
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
> at
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
> at
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
> at
> org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:353)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1586)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1615)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1559)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
> ... 105 more
>
> javax.ws.rs.ProcessingException: java.net.ConnectException: ConnectException
> invoking <a href="http://localhost:8080:">http://localhost:8080: Connection refused (Connection refused)
> Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.Server doStart
> INFO: jetty-9.2.13.v20150730
> Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.handler.ContextHandler
> doStart
> INFO: Started
> o.e.j.s.ServletContextHandler@29612ee2{/__admin,null,AVAILABLE}
> Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.handler.ContextHandler
> doStart
> INFO: Started o.e.j.s.ServletContextHandler@47a90d2a{/,null,AVAILABLE}
> Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.AbstractConnector doStart
> INFO: Started ServerConnector@61756f03{HTTP/1.1}{0.0.0.0:8080}
> Sep 14, 2017 10:32:59 AM org.eclipse.jetty.server.Server doStart
> INFO: Started @401670ms
> Sep 14, 2017 10:33:01 AM
> org.eclipse.jetty.server.handler.ContextHandler$Context log
> INFO: RequestHandlerClass from context returned
> com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped
> under returned 'null'
> Sep 14, 2017 10:33:02 AM
> com.github.tomakehurst.wiremock.common.Slf4jNotifier error
> SEVERE: Request was not matched:
> {
>    "url" : "/",
>    "absoluteUrl" : "http://localhost:8080/",
>    "method" : "GET",
>    "clientIp" : "127.0.0.1",
>    "headers" : {
>      "User-Agent" : "Apache-CXF/3.1.10",
>      "Connection" : "keep-alive",
>      "Host" : "localhost:8080",
>      "Pragma" : "no-cache",
>      "Accept" : "*/*",
>      "Cache-Control" : "no-cache"
>    },
>    "cookies" : { },
>    "browserProxyRequest" : false,
>    "loggedDate" : 1505381581605,
>    "bodyAsBase64" : "",
>    "body" : "",
>    "loggedDateString" : "2017-09-14T09:33:01Z"
> }
> Sep 14, 2017 10:33:04 AM
> org.eclipse.jetty.server.handler.ContextHandler$Context log
> INFO: RequestHandlerClass from context returned
> com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped
> under returned 'null'
> Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.AbstractConnector doStop
> INFO: Stopped ServerConnector@61756f03{HTTP/1.1}{0.0.0.0:8080}
> Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.handler.ContextHandler
> doStop
> INFO: Stopped o.e.j.s.ServletContextHandler@47a90d2a{/,null,UNAVAILABLE}
> Sep 14, 2017 10:33:08 AM org.eclipse.jetty.server.handler.ContextHandler
> doStop
> INFO: Stopped
> o.e.j.s.ServletContextHandler@29612ee2{/__admin,null,UNAVAILABLE}
>
> com.github.tomakehurst.wiremock.client.VerificationException: A request was
> unmatched by any stub mapping. Closest stub mapping was:   <Click to see
> difference>
>
>
> at
> com.github.tomakehurst.wiremock.client.VerificationException.forSingleUnmatchedRequest(VerificationException.java:43)
> at
> com.github.tomakehurst.wiremock.client.VerificationException.forUnmatchedRequests(VerificationException.java:48)
> at
> com.github.tomakehurst.wiremock.junit.WireMockRule.checkForUnmatchedRequests(WireMockRule.java:87)
> at
> com.github.tomakehurst.wiremock.junit.WireMockRule.access$000(WireMockRule.java:33)
> at
> com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:73)
> at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> at org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:324)
> at
> org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.execute(ClientBeforeAfterLifecycleEventExecuter.java:99)
> at
> org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.on(ClientBeforeAfterLifecycleEventExecuter.java:72)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
> at
> org.apache.openejb.arquillian.common.TestObserver.switchLoader(TestObserver.java:87)
> at
> org.apache.openejb.arquillian.common.TestObserver.observesTest(TestObserver.java:67)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
> at
> org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at
> org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
> 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:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
> at
> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
> at
> org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)
> at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:317)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 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.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:205)
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at
> com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
> at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
> at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
>
> Sep 14, 2017 10:33:08 AM org.apache.openejb.assembler.classic.Assembler
> destroyApplication
> INFO: Undeploying app:
> /home/mark/Documents/dev/mark/apps/cms/target/working-dir/0/com.mark.apps.cms.backing.EnquiriesBackingTest
> Sep 14, 2017 10:33:08 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-nio-20002"]
> Sep 14, 2017 10:33:08 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["http-nio-20002"]
> Sep 14, 2017 10:33:08 AM org.apache.catalina.core.StandardService
> stopInternal
> INFO: Stopping service Tomcat
> Sep 14, 2017 10:33:09 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["http-nio-20002"]
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Reply | Threaded
Open this post in threaded view
|

Re: calling rest service from postconstruct in managed bean

MarkD
I'll give your suggestion a try, however, I have appeared to solve the
problem. I'm afraid I am unable to provide an explanation, I haven't
identified any difference between tests.

Thank-you for your help.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html