Wednesday, July 30, 2008

Enum Serialization with Weblogic EJB Client

I was trying to setup an ejb client to connect to an ejb running on a Weblogic 9 app server. I could connect fine, but kept getting a Mismatched serialization uids error on a Java 5 Enum class. After some digging I found
a fix on JavaRanch. For whatever reason using the wlclient.jar will not work when serializing enums, but using the full blown weblogic.jar is fine. I'm going to ignore the details on this one and just move along, but maybe someone else understands the problem/workaround/fix better?


Unknown said...

Wlclient.jar uses IIOP. An since the RMI-IIOP specification doesn't say anything about Java enums. You'll run into problems using it.

The weblogic.jar uses T3 which has no problems.

I usually just store the ordinal of the enum when parsing stuff around

Jeff Sheets said...

Interesting. So is there any way to force wlclient.jar to use T3? Otherwise I have to package the entire 50MB weblogic.jar with my small little client app.

Unknown said...

I too have the same issue, therefore any fix would certainly be appreciated.

I will post if I find anything other than this:

There are some suggested work around that I have not yet tried.

Unknown said...
This comment has been removed by the author.
Jeff Sheets said...

Nice find on the Sun bug. Let me know if you figure anything out!

Unknown said...

We had a similar issue with Collections over RMI and got round it by wrapping them inside another object.

Seems strange but it worked. Eg.
Instead of someMethod(Collection col )...

someMethod( MyObject obj )

Where object contains the Collection.

I'n my communication with BEA they admit it to be an issue they have to fix for and pass the buck to Sun (technically theyre issue) but they surely could implimenent a workaround.

I'm working trhough work arounds in bug thread, let you know how that goes.