Jan 14th, 2011, 07:26 AM
batchMBeanExporter failed to start - spring batch admin
I have embedded spring batch admin into my own web application. I see from time to time that the context initialization fails with the following exception
Caused by: org.springframework.jmx.export.UnableToRegisterMBe anException: Unable to register MBean [org.springframework.batch.admin.jmx.SimpleStepExec utionMetrics@8497f6] with key 'spring.application:type=JobExecution,name=analysi sJob,step=performAnalysisartition3'; nested exception is javax.management.MalformedObjectNameException: Invalid character `:' in value
at org.springframework.jmx.export.MBeanExporter.regis terBeanNameOrInstance(MBeanExporter.java:602)
at org.springframework.batch.admin.jmx.BatchMBeanExpo rter.registerSteps(BatchMBeanExporter.java:125)
at org.springframework.batch.admin.jmx.BatchMBeanExpo rter.doStart(BatchMBeanExporter.java:281)
at org.springframework.batch.admin.jmx.BatchMBeanExpo rter.start(BatchMBeanExporter.java:234)
at org.springframework.context.support.DefaultLifecyc leProcessor.doStart(DefaultLifecycleProcessor.java :166)
... 24 more
Caused by: javax.management.MalformedObjectNameException: Invalid character `:' in value
at javax.management.ObjectName.parseValue(ObjectName. java:958)
at javax.management.ObjectName.checkValue(ObjectName. java:990)
at javax.management.ObjectName.construct(ObjectName.j ava:709)
at javax.management.ObjectName.<init>(ObjectName.java :1446)
at javax.management.ObjectName.getInstance(ObjectName .java:1346)
at org.springframework.jmx.support.ObjectNameManager. getInstance(ObjectNameManager.java:95)
at org.springframework.jmx.export.naming.MetadataNami ngStrategy.getObjectName(MetadataNamingStrategy.ja va:128)
at org.springframework.jmx.export.MBeanExporter.getOb jectName(MBeanExporter.java:728)
at org.springframework.jmx.export.MBeanExporter.regis terBeanInstance(MBeanExporter.java:631)
at org.springframework.jmx.export.MBeanExporter.regis terBeanNameOrInstance(MBeanExporter.java:598)
... 28 more
This seems to be an issue due to the ":" symbol in the partitioned step's name. Is there a way I can override the naming convention for step names in a partition?
I am using v1.2 in Tomcat 6.0. Has anyone come across such a situation before? Is JMX mandatory for spring batch admin to work?
Last edited by Venk; Jan 14th, 2011 at 09:04 AM.
Jan 14th, 2011, 09:45 AM
JMX is not mandatory and you can disable it by overriding the bean named "batchMBeanExporter" (just put in a dummy String or something). This is a bug though, so if you raise a JIRA it will get fixed (patches and pull requests welcome).
Jan 14th, 2011, 09:49 AM
Thanks for the quick response Dave. I'll raise a JIRA on this.
Looking through the partition implementation, the following is what I found though:
The SimpleStepExecutionSplitter is hardcoded to use ":" as a separator in generating step names and the StepParserStepFactoryBean invariably uses a Simple step execution splitter for creating partitions. And JMX Object names, as per the javadocs at http://download.oracle.com/javase/6/...bjectName.html, cannot contain the colon character.
Last edited by Venk; Jan 14th, 2011 at 10:02 AM.
Jul 22nd, 2011, 02:32 PM
Any fix to this? I'm getting the exact-same issue. I'm at 1.2.0.RELEASE of Spring Batch Admin. Spring Batch version is 2.1.7.RELEASE.
Last edited by jewellcj; Jul 22nd, 2011 at 02:34 PM.
Reason: additional information
Jul 22nd, 2011, 06:23 PM
Temporarily worked-around by cloning the source of SimpleStepExecutionSplitter into a class FixedSimpleStepExecutionSplitter and changing the STEP_NAME_SEPARATOR constant from ":" to "_" . Tried subclassing SimpleStepExecutionSplitter (which is obviously preferable) but unfortunately it's not amenable to being extended.
Jul 25th, 2011, 02:31 AM
I think it's fixed in master in the MBean exporter (I'm surprised that didn't make it into 1.2.0, but it's a while ago, so if you say it's not there, it probably isn't).
Dec 12th, 2012, 03:43 PM
I am having same issue with 1.2.0 as well.