-
1. Re: Seam.Component.getInstance raise Seam is not defined
tausuahmed May 11, 2011 12:13 AM (in response to shanghanyu)Make sure that jboss-seam-remoting.jar in proper place, If your application in ear based it should be in ear/lib else in web-inf/lib.
Thanks,
Tauseef -
2. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 11, 2011 10:31 AM (in response to shanghanyu)Thx, Tauseef.
But I already have it in the ear/lib and web-inf/lib, not working. Also I tried to put it only in the ear/lib. No luck as well.
-
3. Re: Seam.Component.getInstance raise Seam is not defined
lvdberg May 11, 2011 11:29 AM (in response to shanghanyu)Hi,
Sometimes the caching gets in the way. When you do different deploys, the JS content doesn't change, try if clearing your cache helps. If not send some addtional code from the bean.
Leo
-
4. Re: Seam.Component.getInstance raise Seam is not defined
sherkan777 May 12, 2011 6:35 AM (in response to shanghanyu)If you are working on localhost try to add prefix to your web script mapping
for an example:
<script type="text/javascript" src="/myProj/game/resource/remoting/resource/remote.js" /> <script type="text/javascript" src="/MyProj/game/resource/remoting/interface.js?playersHistoryAction" />
if you are working on production server, remove
/myProj/
,
Second question, do you have any stacktrace server error msg?
Try to debug page on FF and show us your javascript console error. -
5. Re: Seam.Component.getInstance raise Seam is not defined
sherkan777 May 12, 2011 6:36 AM (in response to shanghanyu)And one more think...show your java class method.
-
6. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 13, 2011 11:08 AM (in response to shanghanyu)hey, Sherkan
I am working on localhost, and it's a seam-gen project by the way. I tried to add the prefix as you mentioned, still no luck.
There is no stacktrace or error msg. Just the firebug gave me this:
Seam.Component.getInstance("helloAction").sayHello is not a function
[Break On This Error] Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);
The java class is just from the seam doc, I didn't change anything, one is
import org.jboss.seam.annotations.Name;
@Name("helloAction")
public class HelloAction {
public String sayHello(String name) {
return "Hello, " + name;
}
}
the other is
import javax.ejb.Local;
import org.jboss.seam.annotations.remoting.WebRemote;
@Local
public interface HelloLocal {
@WebRemote
public String sayHello(String name);
} -
7. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 13, 2011 12:38 PM (in response to shanghanyu)Hey, Sherkan
I modified the path again, now Im getting this error, but still no stacktrace.
Seam.Component.getInstance("helloAction").sayHello is not a function
[Break On This Error] Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);
I think probably it is the path that is causing problems here, any idea how I can fix this step?
thx -
8. Re: Seam.Component.getInstance raise Seam is not defined
lvdberg May 13, 2011 12:53 PM (in response to shanghanyu)Hi,
You forgot to
implement
the interface on your class. So your Bean should be:public class HelloAction implements HelloLocal
Leo
-
9. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 13, 2011 1:31 PM (in response to shanghanyu)Thx, thats one silly mistake , I forgot that, but added it in I still get the same problem.
Seam.Component.getInstance("helloAction").sayHello is not a function
[Break On This Error] Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback); -
10. Re: Seam.Component.getInstance raise Seam is not defined
lvdberg May 13, 2011 1:52 PM (in response to shanghanyu)Hi,
have you looked at the configuration in web.xml. Is maybe the resouce definition missing ?
Leo
-
11. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 13, 2011 2:16 PM (in response to shanghanyu)Thx Leo.
This is what I put in the web.xml.
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping> -
12. Re: Seam.Component.getInstance raise Seam is not defined
lvdberg May 13, 2011 2:55 PM (in response to shanghanyu)Hi,
if everything is configured as stated, there shouldn't be a reasong that it doesn't work,
So maybe there are other things to consider.
Try to download the scripts manually. Use your browser an type the full url of the resource for the js file. If you can't dowload it, you're probably in a subdirector, so you need to prefix the url of the link. You can do this with:
src="#{request.contextPath}/seam/resource/remoting/resource/remote.js"
If this is the case you should do the same with the bean-script, so instead of using the s-tag.
You need to use the full definition as described in the doc.<script type="text/javascript" src="#{request.contextPath}/seam/resource/remoting/interface.js?helloAction"></script>
Leo
-
13. Re: Seam.Component.getInstance raise Seam is not defined
shanghanyu May 13, 2011 3:18 PM (in response to shanghanyu)I tried to download the js file and it can be downloaded......
-
14. Re: Seam.Component.getInstance raise Seam is not defined
lvdberg May 13, 2011 4:57 PM (in response to shanghanyu)Hi,
change the s-tag to the normal script line and try it again. If it still refuses, try to clean your browser cache. As stated before that can be the cause, because it happened to me when I changed a componet a number of times.
Leo