Since you use spring testing, maybe try that @DirtiesContext to have it re-create the spring for each test so you don't have side-effects.
Maybe that helps. On Thu, Nov 14, 2013 at 9:04 AM, CamelTyro <[email protected]> wrote: > The version of camel is 2.12.1 > The version of Spring is 3.2.4.RELEASE > The version of Maven is 3.1.1 > > My application is start through Tomcat, and the default jmx object such as > route, endpoint was published and accessable. > > When running the junit test in eclipse, the default jmx object such as > route, endpoint was published and accessable. > > But when run mvn clean install, the unit test failed because count not find > the jmx object published. > > I use junit4 to test, the unit test was annotated by > @RunWith(SpringJUnit4ClassRunner.class) > @ContextConfiguration(locations = { > "file:src/main/webapp/WEB-INF/applicationContext.xml", > "classpath:applicationContext-test.xml"}) > > I config the camel context as below > <camelContext id="camelContext" trace="true" managementNamePattern="#name#" > xmlns="http://camel.apache.org/schema/spring"> > <contextScan /> > <jmxAgent id="agent" createConnector="true" registryPort="18088" /> > <endpoint id="traced" > > uri="jpa://com.isoftstone.esb.base.entry.RouterMessage?persistenceUnit=tracer" > /> > </camelContext> > When using maven to build, I was told the jmx instance not exists. > So what I should do to let it build successfully? > I hope when test running, the default jmx objects metioned above can be > published. > > Besides, > there are 9 tests in my project, as they were running, the maven expressed > the context agent , defined by /<jmxAgent id="agent" createConnector="true" > registryPort="18088" />/ > ,existed when register the context agent jmx instance, I think the agent > instance should be created before the test method invoking, and destroyed > and unregistered after the test method finish. is it right? or what can I do > to change the test to avoid re-register mbean. > Thanks sincerely. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/how-to-build-camel-jmx-with-maven-tp5743222p5743250.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
