Not a function error in SEAM Remoting
roniraja May 30, 2009 3:22 AMWe are trying to integrate SEAM remoting functionality. Thus we exploded SEAM remoting example seam-helloworld. Everything works fine. But if we integrate this example one-to-one in our existing SEAM projekt we get the error Seam.Component.getInstance("helloAction").sayHello is not a function. No debug info, though debug is set true in components.xml.
Here the generated html page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="/ops/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js" type="text/javascript"></script><script src="/ops/a4j/g/3_3_1.GA/org/richfaces/ui.pack.js" type="text/javascript"></script><link class="component" href="/ops/a4j/s/3_3_1.GA/org/richfaces/skin.xcss/DATB/eAH7elzxQujyGdIAFosEXQ__" rel="stylesheet" type="text/css" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Seam Remoting - Hello World Example</title>
</head>
<body>
<h1>Seam Remoting - Hello World Example</h1>
<p>
</p>
<script src="seam/resource/remoting/resource/remote.js" type="text/javascript">
</script>
<script src="seam/resource/remoting/interface.js?helloAction" type="text/javascript">
</script>
<script type="text/javascript">
function sayHello() {
var name = prompt("What is your name?");
if (name == null) return;
var callback = function(result) { alert(result); };
Seam.Component.getInstance("helloAction").sayHello(name, callback);
}
</script>
<button onclick="javascript:sayHello()">Say Hello</button>
</body>
</html>Here the output from FireBug:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<div id="_firebugConsole" style="display: none;" FirebugVersion="1.3.3"/>
<body>
<h1>Seam Remoting - Hello World Example</h1>
<p> </p>
<script type="text/javascript" src="seam/resource/remoting/resource/remote.js">
...
</script>
<script type="text/javascript" src="seam/resource/remoting/interface.js?helloAction">
1 Seam.Remoting.type.helloAction = function() {
2 }
3
4 Seam.Remoting.type.helloAction.__name = "helloAction";
5 Seam.Remoting.type.helloAction.__metadata = [
6 ];
7
8 Seam.Component.register(Seam.Remoting.type.helloAction);
9
10
</script>
<script type="text/javascript">
1
2 function sayHello() {
3 var name = prompt("What is your name?");
4 if (name == null) return;
5 var callback = function(result) { alert(result); };
6 Seam.Component.getInstance("helloAction").sayHello(name, callback);
7 }
8
</script>
<button onclick="javascript:sayHello()">Say Hello</button>
</body>
We are using JBoss AS 4.2.3, SEAM 2.1.1.GA and Richfaces 3.3.1.GA, please help!
Thanks.