My web application does not work but same code works for stanalone application
nidhi_ac
New Altair Community Member
I have written a code that creates a training model for a sample data, which then classifies the actual dataset on the basis of the trained model. however, the code code runs fine when i run it as a stand alone application, however it gives a ClassCastException when i run it as a web application. i m using RapidMiner4.1 , tomcat server & JDK1.6. it gives me error as
com.rapidminer.operator.ContainerModel cannot be cast to com.rapidminer.operator.IOObject
at com.rapidminer.operator.AbstractIOObject.read(AbstractIOObject.java:114)
at com.rapidminer.operator.io.ModelLoader.apply(ModelLoader.java:94)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:377)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.Process.run(Process.java:571)
at com.rapidminer.Process.run(Process.java:541)
at com.rapidminer.Process.run(Process.java:531)
at com.cts.rapidminer.training.CreateExampleSet.classifyTestData(CreateExampleSet.java:198)
at com.cts.rapidminer.testing.TestDataClassifier.doPost(TestDataClassifier.java:37)
Can somebody please help me?
com.rapidminer.operator.ContainerModel cannot be cast to com.rapidminer.operator.IOObject
at com.rapidminer.operator.AbstractIOObject.read(AbstractIOObject.java:114)
at com.rapidminer.operator.io.ModelLoader.apply(ModelLoader.java:94)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:377)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.Process.run(Process.java:571)
at com.rapidminer.Process.run(Process.java:541)
at com.rapidminer.Process.run(Process.java:531)
at com.cts.rapidminer.training.CreateExampleSet.classifyTestData(CreateExampleSet.java:198)
at com.cts.rapidminer.testing.TestDataClassifier.doPost(TestDataClassifier.java:37)
Can somebody please help me?
Tagged:
0
Answers
-
May I ask what you are trying to achieve?
Does the problem happen on the server or on the client?
Please provide some more information about what is going on. Does the model get serialized? If yes, are you using compatible versions on both sides? Are you sure your web container uses the same class loaders for both classes?
Does the model go through a WebService call? If yes, let me remark that you are loosing the inheritance structure when importing web services on the client side, although I can hardly imagine that this is your problem here.
Cheers,
Simon
0 -
Simon to answer to ur question r as
May I ask what you are trying to achieve? -- i m trying to apply the model created by the rapidminer to a sample test data.
Does the problem happen on the server or on the client? --- it occurs on the server itself
Please provide some more information about what is going on. -- i m creating a model on a traindataset. the model is getting created (i.e a .mod file is created). When i m tring to apply that model on other sample datadataset by ModelApplier operator of rapidminer i m getting the error.
Does the model get serialized? If yes, are you using compatible versions on both sides? -- the model is getting serialized. What do u mean by compatible versions on both sides??
Are you sure your web container uses the same class loaders for both classes? -- yes
0 -
Hi,
Are you? There is no ModelApplier on the stack trace. I only see the ModelLoader.nidhi ac wrote:
Please provide some more information about what is going on. -- i m creating a model on a traindataset. the model is getting created (i.e a .mod file is created). When i m tring to apply that model on other sample datadataset by ModelApplier operator of rapidminer i m getting the error.
I mean the common notion of compatibility when speaking about Java object serialization. Admittedly, if that was the problem, you would probably get a different exception.nidhi ac wrote:
Does the model get serialized? If yes, are you using compatible versions on both sides? -- the model is getting serialized. What do u mean by compatible versions on both sides??
Absolutely? Otherwise I cannot imagine why the ContainerModel cannot be cast to IOObject, because it inherits from IOObject.nidhi ac wrote:
Are you sure your web container uses the same class loaders for both classes? -- yes
Could it be that you have several versions of the two classes (ContainerModel and IOObject) on the classpath which are being confused?
You did not answer my question whether anything went through a WebService.
Cheers,
Simon
0 -
no, i am not using web services.0
-
Any updates? Did you try dumping the classloaders that are being used inside the ModelLoader? That could give some insight as to where the problem is.
We recently had a similar problem that occurs when using more than one plugin. We have changed the class loading mechanism for 4.5 slightly, which might also affect your problem.
Best,
Simon
P.S. Your problem might be related to this one:
http://rapid-i.com/rapidforum/index.php/topic,1056.0.html
4.5. is soon to come, please report whether this affects your problem.0