RuedigerMoeller / fast-cast

hp low latency reliable multicast messaging
GNU Lesser General Public License v3.0
123 stars 17 forks source link

Casting issue using fst-2.4.0 #2

Closed ecmnet closed 8 years ago

ecmnet commented 8 years ago

When trying to run the FastCast 3.0 example, I get the following error:

org.nustaq.fastcast.impl.DataPacket_Struct cannot be cast to org.nustaq.offheap.structs.structtypes.StructString

I am using fst-2.4-oneja.jar.

Any help?

RuedigerMoeller commented 8 years ago

Which example do you run ? Which JDK ?

RuedigerMoeller commented 8 years ago

Just tested PongServer (needed to adjust config to localhost) and Ping example .. works. Also verified MultipleStructsExample.

You need to build the examples using the pom.xml so it uses the official distributed maven artifact of fast-cast. If you build fast-cast yourself, you might run into trouble as fast cast artifact requires some special compiler settings to work correctly. from fast-cast pom.xml:

<artifactId>maven-compiler-plugin</artifactId>
                <!--<version>2.3.2</version>-->
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <debug>true</debug>
                    <debuglevel>lines,vars,source</debuglevel>
                    <optimize>false</optimize>
                    <verbose>true</verbose>
                </configuration>
RuedigerMoeller commented 8 years ago

oops, just saw you are using "onejar", maybe this one is broken .. will check

RuedigerMoeller commented 8 years ago

Hm .. there is no "fat jar" provided for fast-cast 3.0. You are trying to run a fast cast 3 example with a fast-cast 2.0 jar. Pls use the official maven pom.xml as provided in examples to build and run the examples.

ecmnet commented 8 years ago

I just solved the issue, I was using fst-2.4.0 (I am using the fast serialization library already) while pom.xml refers to version 2.19. I run my application now with 2.18 of your FST library and it works, although I am facing now an additional issue regarding

FSTStructFactory.getInstance().registerSystemClz((byte)127, Packet.class, DataPacket.class, RetransPacket.class, RetransEntry.class, ControlPacket.class);

within an eclipse plugin:

!ENTRY org.eclipse.ui 4 0 2015-10-29 21:08:21.317 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at javassist.CtClassType.setSuperclass(CtClassType.java:714) at org.nustaq.offheap.structs.unsafeimpl.FSTStructFactory.createStructClz(FSTStructFactory.java:135) at org.nustaq.offheap.structs.unsafeimpl.FSTStructFactory.getProxyClass(FSTStructFactory.java:347) at org.nustaq.offheap.structs.unsafeimpl.FSTStructFactory.registerClz(FSTStructFactory.java:604) at org.nustaq.offheap.structs.unsafeimpl.FSTStructFactory.(FSTStructFactory.java:100) at org.nustaq.offheap.structs.unsafeimpl.FSTStructFactory.getInstance(FSTStructFactory.java:53)

RuedigerMoeller commented 8 years ago

sorry, I am sometimes way too hasty. So the problem is:

1) fast-cast samples do not run with fst 2.40 (i tested with 2.19) 2) fst-structs byte code instrumentation does not run inside eclipse plugin

right ?

for 1) I do not regulary retest with newer versions of fst, so this is definitely an issue to resolve for 2) this is probably classloader related. I solved a similar issue for kontraktor (also uses javassist), I have to check if the fix can also be applied to fast-cast.

ecmnet commented 8 years ago

No problem. 1) I switch back to 2.18, which is not a problem for me. 2) Is more serious currently. Thank you anyway for your great work and your quick replies here ;-)

RuedigerMoeller commented 8 years ago

2.19 !

note: fast-cast broke from fst 2.29 to 2.30

ecmnet commented 8 years ago

Seems that your fixes also solved the eclipse plugin issue.

RuedigerMoeller commented 8 years ago

Great, this was a lucky shot. I blindly copied a fix from kontraktor byte code instrumentation which in turn has been contributed by a user who runs kontraktor inside tomcat.