Table of Contents

Simulation tool troubleshooting

1. JIAC multicast not working

Problem

Start agent but activeMQ discovery not working:

[dang@dai142 isco-simulation-agent]$ ./target/appassembler/bin/run_EmbeddedWebAgent
SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version
JIAC version: JIAC TNG Agent Core version 5.2.1 (07.01.2016 15:43:59) (DAI-Labor, TU Berlin)
Initiated multicast sender on port 9999 with group 226.6.6.7 and interval 7500
2018-04-12 17:20:10,969 ERROR [n-867cd38b988.StandardJMSBroker doInit 217] - java.io.IOException: Could not create discovery agent: smartmulticast://default?group=isco
java.io.IOException: Could not create discovery agent: smartmulticast://default?group=isco
	at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
	at de.dailab.jiac.net.discovery.multicast.SourceAwareMulticastDiscoveryAgentFactory.doCreateDiscoveryAgent(SourceAwareMulticastDiscoveryAgentFactory.java:46)
	at org.apache.activemq.transport.discovery.DiscoveryAgentFactory.createDiscoveryAgent(DiscoveryAgentFactory.java:56)
	at de.dailab.jiac.net.SourceAwareDiscoveryNetworkConnector.setUri(SourceAwareDiscoveryNetworkConnector.java:63)
	at de.dailab.jiac.net.SourceAwareDiscoveryNetworkConnector.<init>(SourceAwareDiscoveryNetworkConnector.java:59)
	at de.dailab.jiactng.agentcore.comm.broker.ActiveMQBroker.doInit(ActiveMQBroker.java:208)
	at de.dailab.jiactng.agentcore.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:100)
	at de.dailab.jiactng.agentcore.SimpleAgentNode.doInit(SimpleAgentNode.java:847)
	at de.dailab.jiactng.agentcore.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:100)
	at de.dailab.jiactng.agentcore.SimpleAgentNode.afterPropertiesSet(SimpleAgentNode.java:682)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1119)
	at de.gtarc.embeddedwebagent.control.RunApplication.startAgent(RunApplication.java:28)
	at de.gtarc.embeddedwebagent.control.RunApplication.main(RunApplication.java:20)
Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z                <--------------- THIS IS IT -----
	at de.dailab.jiac.net.discovery.multicast.SourceAwareMulticastDiscoveryAgentFactory.doCreateDiscoveryAgent(SourceAwareMulticastDiscoveryAgentFactory.java:31)
	... 17 more
2018-04-12 17:20:11,229 ERROR [org.apache.activemq.broker.BrokerService start 609] - Failed to start Apache ActiveMQ ([n-867cd38b988StandardJMSBroker, ID:dai142.aot.tu-berlin.de-38267-1523546411076-0:1], {})
java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Could not create discovery agent: smartmulticast://default?group=isco
	at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
	at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2128)
	at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2590)
	at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2506)
	at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:710)
	at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:670)
	at org.apache.activemq.broker.BrokerService.start(BrokerService.java:606)
	at de.dailab.jiactng.agentcore.comm.broker.ActiveMQBroker.doInit(ActiveMQBroker.java:220)
	at de.dailab.jiactng.agentcore.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:100)
	at de.dailab.jiactng.agentcore.SimpleAgentNode.doInit(SimpleAgentNode.java:847)
	at de.dailab.jiactng.agentcore.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:100)
	at de.dailab.jiactng.agentcore.SimpleAgentNode.afterPropertiesSet(SimpleAgentNode.java:682)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:312)

Cause

  Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z 
  

This https://stackoverflow.com/a/25914310/707704 pointo log4j

Maven dependency tree

[INFO] +- com.gtarc.planning:plannerAgent:jar:1.2.0-SNAPSHOT:compile
[INFO] |  +- com.gtarc.planning:planExecutorAPI:jar:1.2.0-SNAPSHOT:compile
[INFO] |  +- com.gtarc.planning:planExecutor:jar:1.2.0-SNAPSHOT:compile
[INFO] |  |  +- de.dailab.model.domain:CommonDomainModel:jar:1.4-SNAPSHOT:compile
[INFO] |  |  |  +- org.eclipse.emf:ecore:jar:2.8.0-v20120911-0500:compile
[INFO] |  |  |  +- org.eclipse.emf:common:jar:2.8.0-v20120911-0500:compile
[INFO] |  |  |  +- de.dailab.spa2.model.domain:DomainModel:jar:2.5:compile
[INFO] |  |  |  |  +- de.dailab.spa2.model.spa:SPAModel:jar:2.5:compile
[INFO] |  |  |  |  |  \- de.dailab.spa2.common:Common:jar:2.5:compile
[INFO] |  |  |  |  |     \- org.eclipse.emf.ecore:xmi:jar:2.8.0-v20120911-0500:compile
[INFO] |  |  |  |  \- org.eclipse.core:runtime:jar:3.5.0:compile
[INFO] |  |  |  +- de.dailab.spa2.model.semantic:SemanticModel:jar:2.5:compile
[INFO] |  |  |  |  +- de.dailab.spa2.model.device:DeviceModel:jar:2.4:compile
[INFO] |  |  |  |  |  \- org.eclipse.emf.ecore:change:jar:2.5.0:compile
[INFO] |  |  |  |  +- org.eclipse.emf:query:jar:1.2.100:compile
[INFO] |  |  |  |  \- org.eclipse:osgi:jar:3.4.2:compile
[INFO] |  |  |  \- com.ibm.icu:icu4j:jar:3.4.4:compile
[INFO] |  |  \- log4j:log4j:jar:1.2.9:compile       <-------- THIS VERSION is bad

Fix

Exclude the transitive dependency and add newer version:

		<dependency>
			<groupId>de.dailab.model.domain</groupId>
			<artifactId>CommonDomainModel</artifactId>
			<version>${domain.model.version}</version>
			<exclusions>
				<exclusion>  <!-- declare the exclusion here -->
					<groupId>log4j</groupId>
					<artifactId>log4j</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>