I keep putting answers for myself .. maybe one day someone will help me ...
finally i found out that, for some reason, the java.rmi.server.codebase property is only read once by the jboss jvm. If my bean application changes this property (adds a new codebase) the classes will still be serialised with the old codebase.
Well.. is there anybody in there? Just nod if you can hear me ...
One of the issues with asking questions in a user's forum is that at times you just might be treading in areas where no-one has gone before. In addition, if you attempt to combine several technologies, then the number of forum readers who have used that particular combination tapers off rapidly. Which means that unfortunately sometimes you are just on your own.
Though I guess that if I would have read you question better, and not gotten scared away by the different things you were mentioning (javassist, RMI, downloading classes over port 8083????) and instead focused on your actual question: "does jboss takes in account the property java.rmi.server.codebase when marshaling objects?" I might have done a search through the source code looking for "java.rmi.server.codebase" and come up with the information you just found out: "the java.rmi.server.codebase property is only read once by the jboss".
Thanks Peter ...
I took a deeper look in the Jboss code (including changing some code, recompiling, debugging) and I found the answer to my question.
Basically that's it, jboss only reads once the java.rmi.server.codebase system property.
So my question is: is this a bug? is this the desired behavior?
Here some info about my researches:
-the codebase is set by the org.jboss.web.WebService.createService() method, if the codebase is null on the creation of the service.
- The class JBossRMIClassLoader is responsible for class annotation when marshaling objects. The method "public String getClassAnnotation(Class cl)" should add the annotation (i.e. the codebase), but it delegates this job (adding annotations) to an RMIClassLoaderSpi object that is created when the JBossRMIClassLoader class is loaded. For some resson, the RMIClassLoaderSpi object only reads the codebase once, and not each time it annotates a class. I have changed the code of org.jboss.system.JBossRMIClassLoader.getClassAnnotation(Class cl) method in order to make it print the annnotations. And indeed, the codebase annotations stays the same affter the system property java.rmi.server.codebase has changed.
So yes, we can say, generally, that "Jboss only reads the "java.rmi.server.codebase" property once, at startup.
One can add the java property -Djava.rmi.server.codebase="codebaseJboss someOtherCodebase" to JBoss startup in order to add different codebases.
This solution works for my problem but I'm not happy with it because my application dinamically decides the codebases addresses it uses. So I have to force it to use some specified ports.
So shoud I create a JIRA issue for this? (should that be a bug? or request for new feature? or improovement?)
You can always open a JIRA for a new feature. Providing a patch that implements the feature will greatly enhance the chances of the feature being implemented.