I am launching a model that was created with an old version of repast (RepastSimphony 1.2.0) and I am trying to run it an the latest version of Repast.
I have imported manually the scenarios files to the best of my abilities (I am a beginner with Repast).
Now, when I launch the model in Repast, it has en error because it cannot find a certain file/library/module (I am unsure).
Now, I am not sure whether this is a Repast internal library or some piece of code that I should have been given and that is missing...
Any insight about this error will be welcome !
The error is this one:
WARN [AWT-EventQueue-0] 13:20:38,158 ObjectActionLoader - Error loading information from data. Continuing with model loading.
com.thoughtworks.xstream.converters.ConversionException: repast.score.impl.SGeographyImpl : repast.score.impl.SGeographyImpl
---- Debugging information ----
message : repast.score.impl.SGeographyImpl
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : repast.score.impl.SGeographyImpl
class : java.util.ArrayList
required-type : java.util.ArrayList
converter-type : com.thoughtworks.xstream.converters.collections.CollectionConverter
path : /repast.simphony.visualization.engine.DefaultDisplayDescriptor/projections/repast.score.impl.SGeographyImpl
line number : 61
class[1] : repast.simphony.visualization.engine.DefaultDisplayDescriptor
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version :
I traced that the attempt to load something from the scenario description:
<repast.score.impl.SGeographyImpl>
<name>PeopleGeography</name>
</repast.score.impl.SGeographyImpl>
</projections>
<valueLayers/>
<projectionDescriptors>
<entry>
<string>PeopleGeography</string>
<repast.simphony.visualization.engine.DefaultProjectionDescriptor>
<proj class="repast.score.impl.SGeographyImpl" reference="../../../../projections/repast.score.impl.SGeographyImpl"/>
<props/>
</repast.simphony.visualization.engine.DefaultProjectionDescriptor>
</entry>
</projectionDescriptors>
Incidentally, I tried to run a model from the model library (zombies) and it launches and works properly.
Related
I am trying to parametrize some values in the Precise Throughput Timer. So that this can be passed when jmeter is run from the command line.
The xml snippet is below:
<?xml version="1.0" encoding="UTF-8"?>
<PreciseThroughputTimer guiclass="TestBeanGUI" testclass="PreciseThroughputTimer" testname="Precise Throughput Timer" enabled="true">
<doubleProp>
<name>allowedThroughputSurplus</name>
<value>1.0</value>
<savedValue>0.0</savedValue>
</doubleProp>
<intProp name="exactLimit">10000</intProp>
<doubleProp>
<name>throughput</name>
<value>${req_per_sec}</value> <!-- variable -->
<savedValue>0.0</savedValue>
</doubleProp>
<intProp name="throughputPeriod">1</intProp>
<longProp name="duration">60</longProp>
<intProp name="batchSize">1</intProp>
<intProp name="batchThreadDelay">0</intProp>
<longProp name="randomSeed">0</longProp>
</PreciseThroughputTimer>
and then I pass the value in when jmeter is started via:
...
--jmeterproperty req_per_sec=${REQ_PER_SEC} \
...
Where REQ_PER_SEC is a bash environment variable... But this fails to run with the following error:
An error occurred: Error in NonGUIDriver Problem loading XML from:'/jmeter/test.jmx'.
Cause:
NumberFormatException: For input string: "${req_per_sec}"
Detail:com.thoughtworks.xstream.converters.ConversionException:
---- Debugging information ----
cause-exception : com.thoughtworks.xstream.converters.ConversionException
cause-message :
first-jmeter-class : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:105)
class : org.apache.jmeter.save.ScriptWrapper
required-type : org.apache.jmeter.save.ScriptWrapper
converter-type : org.apache.jmeter.save.ScriptWrapperConverter
path : /jmeterTestPlan/hashTree/hashTree/hashTree/PreciseThroughputTimer/doubleProp[2]/value
line number : 90
version : 5.3
-------------------------------
Looking into the logs I also see this:
Caused by: java.lang.NumberFormatException: For input string: "${req_per_sec}"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) ~[?:1.8.0_252]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) ~[?:1.8.0_252]
at java.lang.Double.parseDouble(Double.java:538) ~[?:1.8.0_252]
at java.lang.Double.valueOf(Double.java:502) ~[?:1.8.0_252]
It seems Jmeter is reading the value as a string instead of a double? I cant figure out how to make it get the value passed in via the jmeterproperty property as double.
How do I do this?
You're using the syntax of a JMeter Variable while you're setting a JMeter Property.
You need to either change your ${req_per_sec} to __P() function call like:
${__P(req_per_sec,)}
or add User Defined Variables configuration element and declare req_per_sec global variable with the value of ${__P(req_per_sec,)} if you're using this ${req_per_sec} variable in more than one place:
CONTEXT :
I need to call a "file.py", where is implement my class "myClass", by the Python language OR the JAVA language through Jython.
I do in my "file.py" :
try :
# Jython source file
from com.local.mylocal.jython import ImyClass
except :
ImyClass = None
from threading import Thread
class myClassMetaClass(type) :
def __new__() :
if IClient is None :
bases = (Thread,)
else :
bases = (Thread, ImyClass,)
return type.__new__(metacls, nom, bases, dict)
class myClass(metaclass=myClassMetaClass) :
pass
When I run my PYTHON code, my class : myClass is instance with all metaclass she need. My code run.
When I run my JAVA code who call my PY class through Jython, my code error is :
Exception in thread "main" SyntaxError: ("mismatched input '='
expecting RPAREN", ('../file.py', 52, 22, 'class
myClass(metaclass=myClassMetaClass) :\n')) Blockquote
INVESTIGATION :
I see in "https://github.com/jython/jython3" isaiah solved my probleme.
PROBLEME :
I can't compile the source code on my Windows environement (need : POSIX ...).
I need the "jython3.jar" file.
REQUEST :
How compile jython3 souces on my Windows environement ?
Is it possible to acces to a "jython3.jar" file ?
[EDITED]
The project i'm working on is a 3 folder project in Java J2EE with servlets and Hibernate for the persistance. The structure is as follow: - Admin -> the main program with the beans and HTML/CSS - Jar -> with the jars, Hibernate tools and classes - War -> with the Servlets
Between them, I use Xstream to share the classes and important info.
I'm using Eclipse and Tomcat 7.
Hope that with this all of you get the global idea.
This what the Xstream debugger said:
Caused by: com.thoughtworks.xstream.converters.ConversionException: satdata.musicoterapia.hibernate.Terapeuta0 : satdata.musicoterapia.hibernate.Terapeuta0
---- Debugging information ----
message : satdata.musicoterapia.hibernate.Terapeuta0
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : satdata.musicoterapia.hibernate.Terapeuta0
class : satdata.musicoterapia.hibernate.Usuario
required-type : satdata.musicoterapia.hibernate.Usuario
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /list/Usuario[2]/terapeuta
class[1] : java.util.ArrayList
converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter
version : null
Links (I don't have enough reputiation for have more than 2 links):
Complete StackTrace: http://pastebin.com/6vXyD6hC
XML: http://pastebin.com/YM9q3uvq
Servlet: below, in the comment
Where the problem occurs: below, in the comment
Java classes: below, in the comment
If something is missing, ask and I'll put it here. Thanks for all!!!
In your servlet code you are are mentioning :
xstream.alias("Terapeuta", Terapeuta.class);
In XML file it is given as:
<terapeuta class="satdata.musicoterapia.hibernate.Terapeuta0" resolves-to="Terapeuta">
So in logs you are getting error as:
The exception in logs says:
com.thoughtworks.xstream.mapper.CannotResolveClassException:
satdata.musicoterapia.hibernate.Terapeuta0
it seems your class namein MXL should be satdata.musicoterapia.hibernate.Terapeuta
satdata.musicoterapia.hibernate.Terapeuta0
I am using the library com.thoughtworks.xstream:xstream:1.4.5 to transfer Java object between two machines.
The first one is running Windows 8.1 with Java Hotspot Client VM 1.7.0_51
The second one is running Ubuntu Linux 12.04 with Java HotSpot 64bit Server VM 1.7.0_51
I am transfering a TestNG testcase from the Windows machine to the Linux machine thus requiring XStream for deserialization. When a result is returned from Linux to Windows there is a problem deserializing the XML on the Windows machine.
Obviously the java.lang.UNIX ** classes are not available on the Windows JVM. How do I suppress this exception. These classes are not required for further processing, but could be ignored.
com.thoughtworks.xstream.converters.ConversionException: java.lang.UNIXProcess$ProcessPipeInputStream : java.lang.UNIXProcess$ProcessPipeInputStream
---- Debugging information ----
message : java.lang.UNIXProcess$ProcessPipeInputStream
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : java.lang.UNIXProcess$ProcessPipeInputStream
class : org.apache.commons.exec.StreamPumper
required-type : org.apache.commons.exec.StreamPumper
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /org.testng.internal.TestResult/m_testClass/m_beforeTestMethods/org.testng.internal.ConfigurationMethod/m_instance/driver/executor/connection/process/process/process/executor/streamHandler/outputThread/target/is
line number : 107
class[1] : java.lang.Thread
class[2] : org.apache.commons.exec.PumpStreamHandler
class[3] : org.apache.commons.exec.DefaultExecutor
class[4] : org.openqa.selenium.os.UnixProcess
class[5] : org.openqa.selenium.os.CommandLine
class[6] : org.openqa.selenium.firefox.FirefoxBinary
class[7] : org.openqa.selenium.firefox.internal.NewProfileExtensionConnection
class[8] : org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor
class[9] : org.openqa.selenium.firefox.FirefoxDriver
class[10] : my.work.selenium.MySeleniumTest
class[11] : org.testng.internal.ConfigurationMethod
class[12] : [Lorg.testng.ITestNGMethod;
converter-type[1] : com.thoughtworks.xstream.converters.collections.ArrayConverter
class[13] : org.testng.TestClass
class[14] : org.testng.internal.TestResult
version : 1.4.5
-------------------------------
I found the solution after some further research...
XStream allow to intercept the (un-)marshalling processes by adding converter. Hence I registered the following converter which stop (un-)marshalling as soon as a FirefoxDriver class is identified.
import org.openqa.selenium.firefox.FirefoxDriver;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
public class CutoffConverter implements Converter{
#SuppressWarnings("unchecked")
public boolean canConvert(Class type) {
return type.equals(FirefoxDriver.class);
}
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
}
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
return null;
}
}
Registering it at the XStream instance is simple:
XStream xstream = new XStream();
xstream.registerConverter(new CutoffConverter());
Maybe someone finds this helpful.
I am using docx4j to parse docx file.
I downloaded all JARs from docx4j site docx4j downloads.
When I used it in code, it gives runtime error at very first line of code: -
WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("Global_OPO_Profile_EN.docx")));
Exception is:
INFO org.docx4j.utils.Log4jConfigurator .configure line 45 - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically.
ERROR org.docx4j.jaxb.Context .<clinit> line 64 - PANIC! No suitable JAXB implementation available
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.relationships
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:47)
at org.docx4j.jaxb.Context.<clinit>(Context.java:56)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
INFO org.docx4j.jaxb.Context .<clinit> line 76 - loading Context jc
ERROR org.docx4j.jaxb.Context .<clinit> line 102 - Cannot initialize context
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.wml
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.Context.<clinit>(Context.java:77)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
ERROR org.docx4j.openpackaging.contenttype.ContentTypeManager .parseContentTypesFile line 690 - java.lang.NullPointerException
org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:691)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
... 8 more
Java 1.5 does not include JAXB, so you need to download the JAXB reference implementation, and add it to your class path.