问题
I have a problem integrating GWT into OSGi Equinox container. The entry point webpage runs. I see my first page. However, when I click on a button to realize server call, it does not run. I work with Firefox and I have firebug. Then, when I see network field I get the next message:
Content-Type text/html; charset=iso-8859-1
Cache-Control must-revalidate,no-cache,no-store
Content-Length 1431
Server Jetty(6.1.x)
Host localhost
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Content-Type text/x-gwt-rpc; charset=utf-8
X-GWT-Permutation CCF6A1341D371C4123AE827BC29EA602
X-GWT-Module-Base http://localhost/zbapp/zb_app/
Referer http://localhost/zbapp/ZB_app.html
Content-Length 174
Pragma no-cache
Cache-Control no-cache
Post method:
7|0|6|http://localhost/zbapp/zb_app/|A31E1254E17F9AD731856D6BE34124A2|main.java.com.gwt.app.client.GreetingService|greetServer|java.lang.String/2004016611||1|2|3|4|2|5|5|6|6|
And response:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 ProxyServlet: /zbapp/zb_app/greet</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /zbapp/zb_app/greet. Reason:
<pre> ProxyServlet: /zbapp/zb_app/greet</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
</body>
</html>
Problem accessing /zbapp/zb_app/greet. Reason:
ProxyServlet: /zbapp/zb_app/greet
It looks the call is performed, but it can not access. I do not know the problem. Could someone help me? I need to solve it to integrate it with other services.
Thanks a lot!
Regards!
回答1:
I don't know how to work with Spring, but I have integrated an OSGi bundle with GWT, and hopefully this will help you do that.
Have a look at this: http://bryanhunt.wordpress.com/2010/05/14/osgi-as-a-web-application-server/. The tutorial shows how to integrate a servlet into an OSGi bundle, step by step. Then have a look at this http://wiki.eclipse.org/Google_Web_Toolkit_and_Equinox. That link pretty much explains everything you need to know to integrate GWT into an OSGi bundle, besides how to wrap the GWT jars, which is easy to do:
In eclipse, go file > new project > plug in development > plug-in from existing jar archive. Then choose add external and pick your GWT-user jar (and GWT-dev if you want, but this isn't necessary for the server-side only stuff). You can choose to extract the jars or not, it doesn't matter. The manifest file will automatically be generated and will export all the GWT functionality. You should then simply require this bundle in your servlet bundle's manifest file.
The second minor issue with the (last) tutorial is that he states you need to remove the lines in the GWT bundle's manifest (the one you just made from the jar) that export javax.servlet.* This is correct, but when you do this you should also add the line Require-Bundle: javax.servlet
to the GWT bundle's manifest, otherwise you will get a classloader exception.
I hope this helps.
回答2:
Well, I solve the first problem, I achieved!!! I have added the extension flag on file plugin.xml as:
<extension point="org.eclipse.equinox.http.registry.servlets">
<servlet alias="/zbapp/zb_app/greet" class="main.java.com.gwt.app.server.GreetingServiceImpl" />
</extension>
However, my error changes to 500. The cause is:
java.lang.NoClassDefFoundError: org/springframework/asm/ClassVisitor
But I have deployed org.springframework.asm bundle and also I have added in the Import-Packages tag org.springframework.asm package.
The version of spring is 3.1.0, I do not why does it happen? I only think if the error is due to version of Spring.
Thanks!
来源:https://stackoverflow.com/questions/6110214/problem-integrating-gwt-and-osgi