Spark with Cassandra: Failed to register spark.kryo.registrator - scala

Currently I encounter some problems when I try to run Spark with Cassandra on standalone mode.
Initially, I run successfully with parameter mater="local[4]" in SparkContext.
Then, I try to move to standalone mode. What I used are:
Ubuntu: 12.04
Cassandra: 1.2.11
Spark: 0.8.0
Scala: 2.9.3
JDK: Oracle 1.6.0_35
Kryo: 2.21
At first, I got "unread block" error. As suggestion in other topic I change to use Kryo serializer and add Twitter Chill. Then, I get the " Failed to register spark.kryo.registrator " in my console and the Exception as below:
13/10/28 12:12:36 INFO cluster.ClusterTaskSetManager: Lost TID 0 (task 0.0:0)
13/10/28 12:12:36 INFO cluster.ClusterTaskSetManager: Loss was due to java.io.EOFException
java.io.EOFException
at org.apache.spark.serializer.KryoDeserializationStream.readObject(KryoSerializer.scala:109)
at org.apache.spark.broadcast.HttpBroadcast$.read(HttpBroadcast.scala:150)
at org.apache.spark.broadcast.HttpBroadcast.readObject(HttpBroadcast.scala:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at scala.collection.immutable.$colon$colon.readObject(List.scala:435)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:39)
at org.apache.spark.scheduler.ResultTask$.deserializeInfo(ResultTask.scala:61)
at org.apache.spark.scheduler.ResultTask.readExternal(ResultTask.scala:129)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:39)
at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:61)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:153)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Someone also encountered the EOFException in spark before, the answer is not register the registrator correctly. I register the Registrator following the Spark guide. Registrator as below:
class MyRegistrator extends KryoRegistrator {
override def registerClasses(kryo: Kryo) {
kryo.register(classOf[org.apache.spark.rdd.RDD[(Map[String, ByteBuffer], Map[String, ByteBuffer])]])
kryo.register(classOf[String], 1)
kryo.register(classOf[Map[String, ByteBuffer]], 2)
}
}
And I also set the property just as the guide does.
System.setProperty("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
System.setProperty("spark.kryo.registrator", "main.scala.MyRegistrator")
Can anyone give me some hints where I did wrong?
Thanks.

Based on my experience, the reasons to get the "EOFException" and the "data unread block" are the same. They lack some libraries when running on the clusters. The most wired thing is that I have add the libraries with "sbt assembly" in spark and the libraries are actually existing in the jars folder. But the spark still cannot find and load them successfully. Then I add the libraries in the spark context, it works. That means I need to transport the libraries to each nodes by specifying in the code.

Related

JMeter : Exception java.lang.ArrayIndexOutOfBoundsException when converting GWTRPC to XML

Running JMeter 2.11 with Java 1.8.0_45 , I get this exception when recording a scenario using UbikLoadPack GWT Plugin for JMeter.
2016/02/04 12:03:48 ERROR - com.ubikingenierie.jmeter.plugin.gwt.renderer.RenderAsGwtRPCResponse: Exception converting to XML://OK[3,-6,2,0,12,12,0,0,-1,11,0,0,'VKq$9BG',0,0,0,0,12,12,6,11,0,10,9,8,7,1,6,0,5,0,1,0,0,0,0,0,0,0,1,10,4,0,1,1,'A',3,0,2,0,0,0,0,30,'A',0,1,["com.edgenius.wiki.gwt.client.model.UserModel/3228739334","anonymous user","anonymous","[I/2970817851","/static/images/noportrait.jpg","java.util.ArrayList/4159755760","com.edgenius.wiki.gwt.client.model.RoleModel/1814311428","unregister users group","Public","ROLE_SYS_ANONYMOUS","java.lang.Integer/3438268394",""],0,7], message:-1 java.lang.ArrayIndexOutOfBoundsException: -1
at com.thoughtworks.xstream.core.util.OrderRetainingMap.entrySet(OrderRetainingMap.java:77)
at java.util.HashMap.putMapEntries(Unknown Source)
at java.util.HashMap.putAll(Unknown Source)
at com.thoughtworks.xstream.core.util.OrderRetainingMap.<init>(OrderRetainingMap.java:36)
at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:135)
at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:76)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:126)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:81)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:229)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:208)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:171)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:116)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:895)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:884)
at com.ubikingenierie.jmeter.plugin.gwt.xml.GwtXmlConverter.a(GwtXmlConverter.java:71)
at com.ubikingenierie.jmeter.plugin.gwt.xml.GwtXmlConverter.a(GwtXmlConverter.java:53)
at com.ubikingenierie.jmeter.plugin.gwt.renderer.RenderAsGwtRPCResponse.a(RenderAsGwtRPCResponse.java:70)
at com.ubikingenierie.jmeter.plugin.gwt.renderer.RenderAsGwtRPCResponse.renderResult(RenderAsGwtRPCResponse.java:36)
at org.apache.jmeter.visualizers.ViewResultsFullVisualizer.valueChanged(ViewResultsFullVisualizer.java:253)
at javax.swing.JTree.fireValueChanged(Unknown Source)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown Source)
at javax.swing.JTree.setSelectionPath(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This issue is due to the Usage of JMeter 2.11 with Java 8.
JMeter is compatible with Java 8 only starting from JMeter 2.12, so you need to upgrade to JMeter 2.12 and even better to most recent supported version of JMeter which is as of this writing JMeter 2.13.

How to connect to MongoDB using SoapUI JDBC Test Step?

I am using SoapUI for testing REST/SOAP services. At a point I need to connect to MongoDB and extract some value from the db.
I am stuck with initializing the db.
Error Snippet below:
com.eviware.soapui.support.SoapUIException: Failed to init connection for driver[com.mongodb.mongo], connectionString [mongodb://<userName>:<pwd>#<domain>:<port>/<collectionName>]
I am unable to invoke connection.
What all I have done?
I have installed the mongoDB driver "mongodb-driver-3.0.0" # "C:\Program Files\SmartBear\SoapUI-5.1.2\bin\ext"
Below is the screenshot of how I am trying to achieve it
The SoapUI Logs as follows:
Sun Jun 07 14:39:24 IST 2015:ERROR:An error occurred [No suitable driver], see error log for details
Sun Jun 07 14:39:24 IST 2015:ERROR:java.sql.SQLException: No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:51)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequestTestStepDesktopPanel$TestConnectionAction.actionPerformed(JdbcRequestTestStepDesktopPanel.java:616)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
All i could see at first place is inability to connect through driver class of mongoDB.
A possible option is installing sleepy mongoose on your mongodb therefore it can respond to HTTP/REST request. Then you can pull whatever information you want directly from mongo using the HTTP request test step in SOAPUI.
Let me know if this was helpful.
You can easily use below groovy code in "Groovy test step" of your test case and connect to mongodb. Before that please ensure that mongodb java client jar file and gmongo are in {Installation Directory}\bin\ext folder of your soapUI installation
Gmongo: http://mvnrepository.com/artifact/com.gmongo/gmongo/1.5
Mongodb Java Client : http://mvnrepository.com/artifact/org.mongodb/mongo-java-driver/3.2.2
import com.gmongo.GMongoClient
import com.gmongo.GMongo
import com.mongodb.MongoCredential
import com.mongodb.ServerAddress
//def credentials = MongoCredential.createMongoCRCredential('admin', 'students', 'admin' as char[])
//def client = new GMongoClient(new ServerAddress("127.0.0.1:27017"))
context.gmongo=new GMongo()
def db=context.gmongo.getDB("test")
log.info db.fruit.find().count()
db.fruit.find().each{
doc->log.info doc
}

Compile issue with GWT back end in libgdx

It compiled fine a few days ago but something i did must have caused the issue but so much was done i am not too sure.
Error log here: http://pastebin.com/P1JHqDBD
If anyone needs anything else to solve the issue, let me know!
I tried deleting the unitcache folder in my HTML5 folder. didnt help, same isse. also tried cleaning.
Thanks in advance
EDIT:
Nov 27, 2013 10:31:12 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[ERROR] Failure in unit cache map load.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to read from byte cache
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.gwt.dev.javac.PersistentUnitCache.awaitUnitCacheMapLoad(PersistentUnitCache.java:466)
at com.google.gwt.dev.javac.PersistentUnitCache.find(PersistentUnitCache.java:391)
at com.google.gwt.dev.javac.CompilationStateBuilder.addArchive(CompilationStateBuilder.java:365)
at com.google.gwt.dev.ArchivePreloader.preloadArchives(ArchivePreloader.java:65)
at com.google.gwt.dev.DevModeBase$UiBrowserWidgetHostImpl.createModuleSpaceHost(DevModeBase.java:106)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:197)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Unable to read from byte cache
at com.google.gwt.dev.util.DiskCache.transferFromStream(DiskCache.java:171)
at com.google.gwt.dev.util.DiskCacheToken.readObject(DiskCacheToken.java:87)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.defaultReadObject(Unknown Source)
at com.google.gwt.dev.javac.CachedCompilationUnit.readObject(CachedCompilationUnit.java:204)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at com.google.gwt.dev.javac.PersistentUnitCache.loadUnitMap(PersistentUnitCache.java:517)
at com.google.gwt.dev.javac.PersistentUnitCache.access$800(PersistentUnitCache.java:96)
at com.google.gwt.dev.javac.PersistentUnitCache$4.run(PersistentUnitCache.java:222)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
Caused by: java.io.StreamCorruptedException: unexpected EOF in middle of data block
at java.io.ObjectInputStream$BlockDataInputStream.refill(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.read(Unknown Source)
at java.io.ObjectInputStream.read(Unknown Source)
at java.io.InputStream.read(Unknown Source)
at com.google.gwt.dev.util.DiskCache.transferFromStream(DiskCache.java:159)
... 27 more
I dont know what i did, i tried removing the war folder and put it back and suddenly it worked ....no idea :/

setAssociatedAction() and setAssociatedScreen() not working

I'm developing some custom screens and custom actions and would like to create associations between them in much the same way that adding a "Create program group" screen suggests adding a "Create program group" action.
So I have a screen, and would like to associate an action with it. The action should be placed on the Installation screen. Within the screens bean info class, I've added the following line to the constructor:
setAssociatedAction(MyAction.class.getName(), InstallationScreen.class.getName());
This doesn't seem to do anything. I recompile, and re-add the screen to the installer, but it doesn't prompt me to add the action. I tried adding the same settings to the action's constructor, thinking that perhaps both need to create an association with each other to work:
setAssociatedScreen(MyScreen.class.getName());
setInstallerTargetScreen(InstallationScreen.class.getName());
It didn't help either. I even tried doing the reverse by creating the action to see if it requests that the screen be created as well, but no luck there. Luckily, setting the installer target screen worked as expected.
I've tried the following as well:
Simple and canonical names for the class name.
The bean info classes, just incase.
I'm not sure what I'm doing wrong, if I am doing anything wrong. The documentation doesn't elude to any additional dependencies:
ScreenBeanInfo
ActionBeanInfo
Hopefully this isn't a bug.
Thanks in advance!
EDIT:
I was about to resolve this, but only as an extension to install4j. I used the wrong class when specifying the Bean class in the BeanInfo.
I had:
public MyActionBeanInfo() {
super("Title", "Description", "Category", false, true, null, MyActionBeanInfo.class);
}
Instead of:
public MyActionBeanInfo() {
super("Title", "Description", "Category", false, true, null, MyAction.class);
}
As a small enhancement, would it be possible to throw an exception, perhaps an IllegalArgumentException, from the super constructor if it is not a valid Bean class?
BUT!
I still received a ClassNotFound and NullPointer exception when not used as an extension.
Here's the stack trace:
java.lang.ClassNotFoundException: com.geowareinc.util.installer.actions.MyAction
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.install4j.gui.views.installer.d.g.a(ejt:92)
at com.install4j.gui.views.installer.i.b.a(ejt:41)
at com.install4j.gui.views.installer.i.b.a(ejt:31)
at com.install4j.gui.views.installer.i.b.a(ejt:18)
at com.install4j.gui.views.installer.d.h.a(ejt:34)
at com.install4j.gui.views.installer.d.h.call(ejt:32)
at com.install4j.gui.views.installer.d.ax.a(ejt:1238)
at com.install4j.gui.views.installer.d.g.a(ejt:32)
at com.install4j.gui.views.installer.b.h.a(ejt:388)
at com.install4j.gui.views.installer.d.ax.f(ejt:691)
at com.install4j.gui.views.installer.d.bd.actionPerformed(ejt:540)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
at sun.reflect.misc.ReflectUtil.checkPackageAccess(Unknown Source)
at sun.reflect.misc.ReflectUtil.isPackageAccessible(Unknown Source)
at java.beans.Introspector.getBeanInfo(Unknown Source)
at com.install4j.gui.views.installer.d.g.b(ejt:60)
at com.install4j.gui.views.installer.i.b.a(ejt:73)
at com.install4j.gui.views.installer.i.b.a(ejt:53)
at com.install4j.gui.views.installer.i.b.a(ejt:31)
at com.install4j.gui.views.installer.i.b.a(ejt:18)
at com.install4j.gui.views.installer.d.h.a(ejt:34)
at com.install4j.gui.views.installer.d.h.call(ejt:32)
at com.install4j.gui.views.installer.d.ax.a(ejt:1238)
at com.install4j.gui.views.installer.d.g.a(ejt:32)
at com.install4j.gui.views.installer.b.h.a(ejt:388)
at com.install4j.gui.views.installer.d.ax.f(ejt:691)
at com.install4j.gui.views.installer.d.bd.actionPerformed(ejt:540)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This is a bug in install4j. Associated screens and actions cannot be loaded if the bean is added on the Installer->Custom code & Resources tab.
This will be fixed in 5.1.7.

Weka Class Invalid for Deserialization

I trained a SimpleKMeans clusterer in Weka Explorer and saved the model to my computer. Now I want to use it in my Java code to cluster an instance I create but I get the following error when I try to deserialize it:
java.io.InvalidClassException: weka.core.Instance; weka.core.Instance;
class invalid for deserialization at
java.io.ObjectStreamClass.checkDeserialize(Unknown Source) at
java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at
java.io.ObjectInputStream.readObject0(Unknown Source) at
java.io.ObjectInputStream.readArray(Unknown Source) at
java.io.ObjectInputStream.readObject0(Unknown Source) at
java.io.ObjectInputStream.defaultReadFields(Unknown Source) at
java.io.ObjectInputStream.readSerialData(Unknown Source) at
java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at
java.io.ObjectInputStream.readObject0(Unknown Source) at
java.io.ObjectInputStream.defaultReadFields(Unknown Source) at
java.io.ObjectInputStream.readSerialData(Unknown Source) at
java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at
java.io.ObjectInputStream.readObject0(Unknown Source) at
java.io.ObjectInputStream.defaultReadFields(Unknown Source) at
java.io.ObjectInputStream.readSerialData(Unknown Source) at
java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at
java.io.ObjectInputStream.readObject0(Unknown Source) at
java.io.ObjectInputStream.readObject(Unknown Source) at
weka.core.SerializationHelper.read(SerializationHelper.java:288) at
weka.core.SerializationHelper.read(SerializationHelper.java:270) at
Test.main(Test.java:32)
where line 32 of my Test class is
Clusterer kmeans_temp = (Clusterer) weka.core.SerializationHelper.read("path/to/model/myclusterermodel.model");
Am I doing it right?
The problem was because I was using two different versions of WEKA to create the model and deserialize the model. I downloaded the source code for the version I used for WEKA explorer and problem solved.