java constant changing during runtime
Hi,
I have a very weird problem occurring, here's the description.
First i have the following interface
public interface IdConstants
{ public static final long INVALID_ID = -1;
public static final String INVALID_ID_STRING = Long.toString(-1);
public static final long INVISIBLEID_ID = -1;
public static final XId INVALID_IDOBJECT = new XId(-1);
}
XId is a wrapper class for a primitive 'long'
public final class XId implements Serializable, Comparable, Loggable
{
private long m_id;
... + getters and setters
}
We have a large J2EE application deployed on Weblogic 8.1 SP3 running JDK 142_05. After 2-3 days of normal activity on one of servers, the value for INVALID_ID or INVALID_IDOBJECT suddently changes from -1 to -2. After rebooting the server, everything becomes fine.
Any clues? is this memory / jvm corruption?
How can i prevent it ?
Thank you
Nabil
[984 byte] By [
nsaidanea] at [2007-11-26 12:44:51]

# 2
Did anyone patch the jar file / ear file, without recompiling every single java class ?
I ask because, at compile time, any class using the static final's in IdConstants, has their values copied into their own class.
eg.
public interface IdConstants
{
public static final long INVALID_ID = -1
}
public class MyClass
{
long myCopy = IdConstants.INVALID_ID;
}
At compile time the value of INVALID_ID is taken from IdConstants and compiled directly into MyClass.If you were to then change the value of IdConstants, and only recompile that class, then MyClass would still contain the old value.That's assuming that at some point in the past, thoses INVALID_ID id's were set to -2.
Other possibilities... since Xld is serialisable, it may not be serializing / deserializing correctly.Maybe you could try explicitely setting the serialVersionUID, to ensure the serialized class is recognized.
static final long serialVersionUID = 4070409649129120458;
regards,
Owen