How to integrate spring batch admin console - spring-batch

I'm using jhipster and I want to integrate spring batch admin console in my webapp. (http://localhost:8080/batch-console for example)
I tried to integrate the following response in my jhipster webapp Is there a way to integrate spring-batch-admin and spring-boot properly? but I get the following error (properties seems to be not loaded)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loggingConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.application.name' in string value "${spring.application.name}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:355)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at com.mycompany.myapp.JhipsterApp.main(JhipsterApp.java:64)
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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.application.name' in string value "${spring.application.name}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:813)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1076)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
... 20 common frames omitted
If I hard code these properties for testing, my jhipster application starts but I get :
Request URL:http://localhost:8080/
Request Method:GET
Status Code:403 Forbidden
What do I need to doexactly to integrate spring batch admin in my Jhipster app?
Do I need to add the following dependency to my pom?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
Spring boot version : 1.4.1.RELEASE
Jhipster version : 3.8.0
Thanks

You don't have to add spring-boot. JHipster is a spring-boot app. As for spring-batch-admin for what I see in the documentation is a web UI using Spring MVC which actualy is also a part of the JHipster stack, but JHipster is using as a client a single page app with AngularJS wich is consuming REST services, i.e. you can have some issue when integrating your batch-admin app.
Your
Request URL:http://localhost:8080/ Request Method:GET Status Code:403 Forbidden it indicates that there are some changing at your authorization since
http://localhost:8080/ is the normal entry point in a JHipster app.
As a solution I will recommend to use the micro service approach. The documentation of spring-batch-admin indicates that there is RESTful (JSON) API. This will perfectly fits into micro services app.

Related

Scala play framework - convert Rest API to HTTPS using .JKS file using organizational CA

Currently I am running scala play application, now it's HTTP APIs are working fine in my Angular UI application locally. But in our organization for higher environment we need to convert it to SSL HTTPS API.
We use our own organizational root CA and I got the myCA_trust.jks certificate file with me.
I added following properties in application.conf file,
play.server.https.keyStore.path="./myCA_trust.jks"
play.server.https.keyStore.password="change_me"
And for deploying the code I am creating the dist, and using following command to deploy it on linux server
./scala-rest-api -Dplay.http.secret.key="application_secreate_key" -Dhttps.port=8094 -Dplay.server.https.keyStore.path=./myCA_trust.jks -Dplay.server.https.keyStore.password=change_me
After doing this I can hit to the HTTPS URL using server address, but getting errors in server console like,
[error] a.a.OneForOneStrategy - ./myCA_trust.jks
akka.actor.ActorInitializationException: akka://application/system/StreamSupervisor-0/flow-2-1: exception during creation
at akka.actor.ActorInitializationException$.apply(Actor.scala:202)
at akka.actor.ActorCell.create(ActorCell.scala:698)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:549)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:571)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:293)
at akka.dispatch.Mailbox.run(Mailbox.scala:228)
at akka.dispatch.Mailbox.exec(Mailbox.scala:241)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
Caused by: java.lang.reflect.InvocationTargetException: null
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 play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.sslEngineProvider$lzycompute(AkkaHttpServer.scala:527)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.sslEngineProvider(AkkaHttpServer.scala:526)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.engineCreateSSLEngine(AkkaHttpServer.scala:528)
at javax.net.ssl.SSLContext.createSSLEngine(SSLContext.java:329)
Caused by: java.nio.file.NoSuchFileException: ./myCA_trust.jks
Please help me to configure HTTPS rest API URL, do let me know if there is anything else I need to add in the code and where.
Thanks and in advance.

An error occured when injecting AuthzClient

Injecting AuthzClient in quarkus 1.13 an error occured.
#Inject
AuthzClient authzClient;
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.keycloak.authorization.client.AuthzClient and qualifiers [#Default]
- java member: io.github.jithset.services.KeycloakServices#authzClient
- declared on CLASS bean [types=[io.github.jithset.services.KeycloakServices, java.lang.Object], qualifiers=[#Default, #Any], target=io.github.jithset.services.KeycloakServices]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1081)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:255)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:419)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.keycloak.authorization.client.AuthzClient and qualifiers [#Default]
- java member: io.github.jithset.services.KeycloakServices#authzClient
- declared on CLASS bean [types=[io.github.jithset.services.KeycloakServices, java.lang.Object], qualifiers=[#Default, #Any], target=io.github.jithset.services.KeycloakServices]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:484)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:378)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:247)
If that is not possible how can i check if user has certain permission with access token.
Thanks
I do not agree with #loicmathieu and #Ladicek. If you want to manage protected resources you NEED to be able to inject the AuthzClient.
This a common usecase when you want to implement user managed authorization. A good example is in the keycloak quickstart repo : https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-authz-uma-photoz.
There is an IT test where the AuthzClient is injected in the official quarkus repository : https://github.com/quarkusio/quarkus/blob/9b09229b86b775a9452d09fca42f18e32f81e924/integration-tests/keycloak-authorization/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java
And the use of the AuthzClient is documented here : https://quarkus.io/guides/security-keycloak-authorization#injecting-the-authorization-client
After some experimentation I found that the AuthzClient bean will only exist when quarkus.keycloak.policy-enforcer.enable=true is added to the configuration.
The easiest way to check for permissions is to use the security annotations as explained in the USING OAUTH2 RBAC guide or injext the security context via #Context SecurityContext ctx.
If you want to have access to the token, assuming you're using the authorization code flow, you can inject the JWT token via #Inject JwtToken jwtToken, more details in the USING OPENID CONNECT TO PROTECT WEB APPLICATIONS USING AUTHORIZATION CODE FLOW guide.
If you"re using Keycloack, you can also inject a io.quarkus.security.identity.SecurityIdentity but as #Ladicek said you're not supposed to directly used internal Keycloack classes, see the USING OPENID CONNECT AND KEYCLOAK TO CENTRALIZE AUTHORIZATION guide.

Trouble saving session when mixing spring-security-gemfire and spring-security-oauth2

Background: I have a web app that utilizes AngularJS, spring-mvc, and spring-rest for delivering the UI. I have a requirement to load balance using an Elastic LB and it is not using sticky sessions; requests are round robin. I implemented session replication using spring-session with gemfire for session storage. This works well.
I need to integrate with an OAuth2 auth server (and eventually multiple OAuth2 servers) purely for authentication and the passing of userInfo. I attempted to use the spring cloud oauth2 #EnableOAuth2Sso on the web-app and hit some session serialization issues. The mere addition of the oauth2ClientContext to the session seemed to cause ClassCastException problems during session saving.
I attempted to pull down the following samples and they worked well out of the box, Particularly the UI and the Authserver.
https://github.com/spring-guides/tut-spring-security-and-angular-js
However, when I added spring session into the mix, trying to serialize to a gemfire server, I encountered the exact same issue.
Here is the stacktrace highlight:
java.lang.ClassCastException: cannot assign instance of org.springframework.beans.factory.support.StaticListableBeanFactory to field org.springframework.aop.scope.DefaultScopedObject.beanFactory of type org.springframework.beans.factory.config.ConfigurableBeanFactory in instance of org.springframework.aop.scope.DefaultScopedObject
Below is abbreviated stacktrace:
ERROR o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
org.springframework.dao.DataAccessResourceFailureException: remote server on machine(gemfire:21800:loner):57660:9d1f3438:gemfire: : While performing a remote put; nested exception is com.gemstone.gemfire.cache.client.ServerOperationException: remote server on machine(gemfire:21800:loner):57660:9d1f3438:gemfire: : While performing a remote put
at org.springframework.data.gemfire.GemfireCacheUtils.convertGemfireAccessException(GemfireCacheUtils.java:238) ~[spring-data-gemfire-1.7.4.RELEASE.jar:1.7.4.RELEASE]
at org.springframework.data.gemfire.GemfireAccessor.convertGemFireAccessException(GemfireAccessor.java:91) ~[spring-data-gemfire-1.7.4.RELEASE.jar:1.7.4.RELEASE]
at org.springframework.data.gemfire.GemfireTemplate.put(GemfireTemplate.java:190) ~[spring-data-gemfire-1.7.4.RELEASE.jar:1.7.4.RELEASE]
at org.springframework.session.data.gemfire.GemFireOperationsSessionRepository.save(GemFireOperationsSessionRepository.java:147) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.data.gemfire.GemFireOperationsSessionRepository.save(GemFireOperationsSessionRepository.java:35) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:244) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:214) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) ~[spring-session-1.2.1.RELEASE.jar:na]
... tomcat filter chain and spring filter stuff
Caused by: com.gemstone.gemfire.cache.client.ServerOperationException: remote server on machine(gemfire:21800:loner):57660:9d1f3438:gemfire: : While performing a remote put
... gemfire internal stuff
at org.springframework.data.gemfire.GemfireTemplate.put(GemfireTemplate.java:187) ~[spring-data-gemfire-1.7.4.RELEASE.jar:1.7.4.RELEASE]
... 31 common frames omitted
Caused by: java.lang.ClassCastException: cannot assign instance of org.springframework.beans.factory.support.StaticListableBeanFactory to field org.springframework.aop.scope.DefaultScopedObject.beanFactory of type org.springframework.beans.factory.config.ConfigurableBeanFactory in instance of org.springframework.aop.scope.DefaultScopedObject
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2133) ~[na:1.7.0_80]
at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1305) ~[na:1.7.0_80]
... java.io stuff
at org.springframework.aop.framework.AdvisedSupport.readObject(AdvisedSupport.java:557) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at sun.reflect.GeneratedMethodAccessor224.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.7.0_80]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058) ~[na:1.7.0_80]
... java.io stuff
at com.gemstone.gemfire.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2966) ~[gemfire-8.1.0.jar:na]
at com.gemstone.gemfire.DataSerializer.readObject(DataSerializer.java:3210) ~[gemfire-8.1.0.jar:na]
at org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository$GemFireSessionAttributes.readObject(AbstractGemFireOperationsSessionRepository.java:800) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository$GemFireSessionAttributes.fromDelta(AbstractGemFireOperationsSessionRepository.java:834) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository$GemFireSession.fromDelta(AbstractGemFireOperationsSessionRepository.java:589) ~[spring-session-1.2.1.RELEASE.jar:na]
at com.gemstone.gemfire.internal.cache.EntryEventImpl.processDeltaBytes(EntryEventImpl.java:1345) ~[gemfire-8.1.0.jar:na]
... gemfire internal stuff
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.7.0_80]
at com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:577) ~[gemfire-8.1.0.jar:na]
... 1 common frames omitted
I found the following, https://jira.spring.io/browse/SPR-14117, which encouraged me to update some of the jars to the newest versions, hoping the spring boot versions were simply behind, however it didn't seem to help.
Version info:
spring-cloud-starter-parent: Brixton.SR4
spring-cloud-security: 1.1.2.RELEASE
spring-core: 4.3.2.RELEASE
spring-security-oauth2: 2.0.10.RELEASE
spring-session: 1.2.1.RELEASE
I've considered a few options: rewiring the OAuth2 framework to no longer use ScopedProxyMode.INTERFACES (seems daunting), use Redis vs. Gemfire, write the entire client from scratch (I've done it before... wasn't fun).
FWIW I've already added the RequestContextFilter as recommended here: OAuth2ClientContext (spring-security-oauth2) not persisted in Redis when using spring-session and spring-cloud-security
Does anyone have any guidance?
I don't know if this speaks to your problem directly but I had/have a similar problem and I think I have all the same versions as you. Seems that there are so many Spring projects and they all try to keep up with each other so sometimes there seem to be compatibility issues. I found the steps outlined here by Rob Winch fixed my issue -https://github.com/spring-projects/spring-session/issues/395

PAX Exam integration test REST client call to REST service fails with Caused by: java.net.SocketTimeoutException: Read timed out

I have an integration test that injects a rest client into the test class. When that rest client calls a rest service being hosted by the same pax exam test container everything stops for about a minute until I get a long list of Socket Read Timeout exceptions and connection refused exceptions. If I inject a rest client that calls a rest service in another container everything works fine. It almost seems like the rest service isn't given a thread to execute in. If I start up the pax exam container manually I can verify that the rest service has started correctly. And if I inject the OSGi service into the test class everything works correctly. Using PaxExam 3.6 and Apache ServiceMix (4.5.3)
Stack Trace:
2015-04-22 17:10:02,211 | WARN | ion(1)-127.0.0.1 | PhaseInterceptorChain | 123 - org.apache.cxf.cxf-api - 2.6.6 | Interceptor for {http://rest.mediation.velocity.randomness.com/}mediationService 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)[123:org.apache.cxf.cxf-api:2.6.6]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[123:org.apache.cxf.cxf-api:2.6.6]
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:530)[139:org.apache.cxf.cxf-rt-frontend-jaxrs:2.6.6]
at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:205)[139:org.apache.cxf.cxf-rt-frontend-jaxrs:2.6.6]
at com.sun.proxy.$Proxy156.getmediations(Unknown Source)
at com.randomness.velocity.mediation.rest.client.mediationClient.getmediations(mediationClient.java:90)[282:mediation-rest-client:3.1.0.SNAPSHOT]
at com.randomness.velocity.mediation.rest.client.mediationClient.getmediations(mediationClient.java:97)[282:mediation-rest-client:3.1.0.SNAPSHOT]
at com.randomness.velocity.itest.client_management.DataCleanupTests.verifyvelocityClientManagementStarts(DataCleanupTests.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_75]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:67)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)[313:org.ops4j.pax.tipi.junit:4.11.0.1]
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_75]
at org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)[311:org.ops4j.pax.exam.rbc:3.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_75]
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)[:1.7.0_75]
at sun.rmi.transport.Transport$2.run(Transport.java:202)[:1.7.0_75]
at sun.rmi.transport.Transport$2.run(Transport.java:199)[:1.7.0_75]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_75]
at sun.rmi.transport.Transport.serviceCall(Transport.java:198)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)[:1.7.0_75]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_75]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)[:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_75]
Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking https://127.0.0.1:7103/mediation/patient/ff8081814ce1299a014ce142cb410065?materialization=Full: Read timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_75]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_75]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_75]
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_75]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1469)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1454)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)[123:org.apache.cxf.cxf-api:2.6.6]
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:659)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)[123:org.apache.cxf.cxf-api:2.6.6]
... 54 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)[:1.7.0_75]
at java.net.SocketInputStream.read(SocketInputStream.java:152)[:1.7.0_75]
at java.net.SocketInputStream.read(SocketInputStream.java:122)[:1.7.0_75]
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)[:1.7.0_75]
at sun.security.ssl.InputRecord.read(InputRecord.java:480)[:1.7.0_75]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)[:1.7.0_75]
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891)[:1.7.0_75]
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)[:1.7.0_75]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)[:1.7.0_75]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)[:1.7.0_75]
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)[:1.7.0_75]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)[:1.7.0_75]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)[:1.7.0_75]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324)[:1.7.0_75]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)[:1.7.0_75]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)[:1.7.0_75]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1532)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1440)[135:org.apache.cxf.cxf-rt-transports-http:2.6.6]
I figured out what was going on. I added an osgi:service to a spring config in the integration test project that exposed the rest client as an osgi service so I could inject the client into the test class. By doing that I created a second service in the osgi container that was advertised via the same interface that the rest service was using to look up the real osgi service implementation. So the rest service was actually getting the rest client injected into it instead of the osgi service impl, this created an infinite loop that finally crashed out and threw tons of connection refused and socket read timeout exceptions to my console. Good stuff

Unable to start a spring boot web application with spring batch admin

I am trying to run a web application with embedded tomcat including a number of spring batch jobs and the spring batch admin. However when I try to run the generated fat jar I get the following error, can anybody from spring batch or boot team help:
Error registering Tomcat:j2eeType=WebModule,name=//localhost/*,J2EEApplication=none,J2EEServer=none
Adding more information:
Version of spring boot: 1.1.9.RELEASE from spring.io parent pom version 1.0.3.RELEASE
I tried running it from STS as well as using mvn spring-boot:run with the same effect.
The batch jobs read from a file and write to hornetq.
The complete stack trace is as follows:
2014-11-14 14:22:45.236 ERROR 404 --- [ost-startStop-1] org.apache.tomcat.util.modeler.Registry : Error registering Tomcat:j2eeType=WebModule,name=//localhost/*,J2EEApplication=none,J2EEServer=none`
javax.management.RuntimeOperationsException: null
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:411)`
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)`
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:742)
at org.apache.catalina.util.LifecycleMBeanBase.register(LifecycleMBeanBase.java:158)
at org.apache.catalina.util.LifecycleMBeanBase.initInternal(LifecycleMBeanBase.java:61)
at org.apache.catalina.core.ContainerBase.initInternal(ContainerBase.java:1084)
at org.apache.catalina.core.StandardContext.initInternal(StandardContext.java:6506)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Repository: cannot add mbean for pattern name Tomcat:j2eeType=WebModule,name=//localhost/*,J2EEApplication=none,J2EEServer=none
... 19 common frames omitted
I assume the name is not a valid object name: //localhost/*
Could you try with a different name, or either escape or quote the name. This should fix the problem.