<< Back to previous view

[QB-120] Remoting API has issues with Facades
Created: 21/Aug/06  Updated: 01/Sep/06

Status: Resolved
Project: QuickBuild
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Matthew Inger Assigned To: Robin Shen
Resolution: Cannot Reproduce Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown


 Description   
It seems that when using the Remoting API, some of the items returned in the ConfigurationFacade are of type HashMap, rather than the actual Facade they should be. Specifically, the "repositories" and "variables" property are returning
List<HashMap> rather than List<RepositoryFacade> and List<VariableFacade> as they should be. As a result, when I modify the configuration, and send it back to quickbuild, it complains that i'm passing invalid classes:

com.caucho.hession.io.HessianServiceException: java.lang.RuntimeException(Invalid facade class: java.util.HashMap).




 Comments   
Comment by Matthew Inger [ 31/Aug/06 08:26 PM ]
I'm still having this problem in 1.1.0.

I duplicate and existing configuration, get back the id, and load that configuration.
I then try to modify a variable definition or two (which for some reason, the items
in the Map returned from the getVariables method are HashMaps, not VariableFacade
instances). When I try to save (even without modifying anything), I'm still getting
this same error. I can't say whether it's the variables or some other part of the
configuration.

I will try to reproduce it in another environment, and see what happens.
Comment by Matthew Inger [ 31/Aug/06 08:49 PM ]
I have narrowed this down to a specific case. It seems that this only occurs
when running from an ANT script. I have tried both of the following with the
exact same results:

1. A Groovy script embedded in my ant build file
2. A custom ANT task to do the duplication.

Here's a simple build script which will work with the pre-packaged hsql database and
illustrate the problem. It requires the hessian and quickbuild-api jars, as well as the
groovy-all-1.0-JSR-06.jar file to be in the "lib" directory of wherever this script is placed.

<project name="test" basedir="." default="test">
    <target name="test">
        <taskdef resource="org/codehaus/groovy/antlib.xml">
            <classpath>
                <fileset dir="lib" includes="**/*.jar" />
            </classpath>
        </taskdef>
        
<groovy>
        import com.caucho.hessian.client.HessianProxyFactory;
        import com.pmease.quickbuild.RemoteService;
        import com.pmease.quickbuild.model.ConfigurationFacade;
           
factory = new HessianProxyFactory();

// specify login information here.
        factory.setUser("admin");
        factory.setPassword("admin");

// specify hessian service URL of your QuickBuild installation.
        remote = (RemoteService) factory.create(RemoteService.class,
                "http://localhost:8080/app.do?service=hessian");

// get the configuration to be copied
        configurationToCopy = remote.getConfigurationByHierarchyName("root.myfirstbuild");
        remote.saveConfiguration(configurationToCopy);
        
</groovy>
    </target>
</project>

Being that it happens only in ANT, i assume it has something to do with hessian and
it's interaction with the ClassLoader (given that ant supplies custom ClassLoader
instances).


It yields the following error:

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: C:\Java\quickbuild-test\test.xml
parsing buildfile C:\Java\quickbuild-test\test.xml with URI = file:///C:/Java/quickbuild-test/test.xml
Project base dir set to: C:\Java\quickbuild-test
Build sequence for target(s) `test' is [test]
Complete build sequence is [test, ]
test:
parsing buildfile jar:file:/C:/Java/quickbuild-test/lib/groovy-all-1.0-JSR-06.jar!/org/codehaus/groovy/antlib.xml with URI = jar:file:/C:/Java/quickbuild-test/lib/groovy-all-1.0-JSR-06.jar!/org/codehaus/groovy/antlib.xml
   [groovy] addText('
   [groovy] import com.caucho.hessian.client.HessianProxyFactory;
   [groovy] import com.pmease.quickbuild.RemoteService;
   [groovy] import com.pmease.quickbuild.model.ConfigurationFacade;
   [groovy]
   [groovy] factory = new HessianProxyFactory();
   [groovy]
   [groovy] // specify login information here.
   [groovy] factory.setUser("admin");
   [groovy] factory.setPassword("admin");
   [groovy]
   [groovy] // specify hessian service URL of your QuickBuild installation.
   [groovy] remote = (RemoteService) factory.create(RemoteService.class,
   [groovy] "http://localhost:8080/app.do?service=hessian");
   [groovy]
   [groovy] // get the configuration to be copied
   [groovy] configurationToCopy = remote.getConfigurationByHierarchyName("root.myfirstbuild");
   [groovy] remote.saveConfiguration(configurationToCopy);
   [groovy]
   [groovy] ')
   [groovy] execute()
   [groovy] execGroovy()
   [groovy] Groovy: import com.caucho.hessian.client.HessianProxyFactory;
   [groovy] import com.pmease.quickbuild.RemoteService;
   [groovy] import com.pmease.quickbuild.model.ConfigurationFacade;
   [groovy]
   [groovy] factory = new HessianProxyFactory();
   [groovy]
   [groovy] // specify login information here.
   [groovy] factory.setUser("admin");
   [groovy] factory.setPassword("admin");
   [groovy]
   [groovy] // specify hessian service URL of your QuickBuild installation.
   [groovy] remote = (RemoteService) factory.create(RemoteService.class,
   [groovy] "http://localhost:8080/app.do?service=hessian");
   [groovy]
   [groovy] // get the configuration to be copied
   [groovy] configurationToCopy = remote.getConfigurationByHierarchyName("root.myfirstbuild");
   [groovy] remote.saveConfiguration(configurationToCopy);

BUILD FAILED
C:\Java\quickbuild-test\test.xml:9: java.lang.reflect.UndeclaredThrowableException
at org.apache.tools.ant.Task.perform(Task.java:373)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy0.saveConfiguration(Unknown Source)
at gjdk.$Proxy0_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:111)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:657)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:363)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:146)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at Script1.run(Script1.groovy:17)
at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:455)
at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:349)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 9 more
Caused by: com.caucho.hessian.io.HessianServiceException: java.lang.RuntimeException(Invalid facade class: java.util.HashMap)
at com.caucho.hessian.io.HessianInput.prepareFault(HessianInput.java:341)
at com.caucho.hessian.io.HessianInput.readReply(HessianInput.java:275)
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:181)
... 22 more
--- Nested Exception ---
java.lang.reflect.UndeclaredThrowableException
at $Proxy0.saveConfiguration(Unknown Source)
at gjdk.$Proxy0_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:111)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:657)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:363)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:146)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at Script1.run(Script1.groovy:17)
at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:455)
at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:349)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: com.caucho.hessian.io.HessianServiceException: java.lang.RuntimeException(Invalid facade class: java.util.HashMap)
at com.caucho.hessian.io.HessianInput.prepareFault(HessianInput.java:341)
at com.caucho.hessian.io.HessianInput.readReply(HessianInput.java:275)
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:181)
... 22 more

Total time: 2 seconds

Comment by Robin Shen [ 01/Sep/06 04:46 AM ]
Thanks for so detail information. I've made a try and found the same problem. To avoid this problem, please add hessian-3.0.8.jar and quickbuild-api.jar to Ant's classpath explicitly.

For example, if these two jars are put under "d:\temp\lib" directory, then use:

"ant -lib d:\temp\lib" will help.

Regards.
Robin
Generated at Fri Oct 31 19:38:24 UTC 2025 using JIRA 189.