Ohh, I almost forgot... your SessionBean has to implement your GWT
RemoteService interface (not the Async one!) ofcourse..

On 8 jan, 19:19, Fushion <[email protected]> wrote:
> Assuming a setup with Eclipse, I did the following:
>
> * Create file /src/jndi.properties:
> ============================
> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
> java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
> java.naming.provider.url=<dns.or.ip.of.j2ee.server>
> ============================
>
> * Create file /war/WEB-INF/jetty-web.xml:
> ============================
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd";>
>
> <Configure class="org.mortbay.jetty.webapp.WebAppContext">
>         <Set name="systemClasses">
>                 <Array type="java.lang.String">
>                         <Item>java.</Item>
>                         <Item>javax.servlet.</Item>
>                         <Item>javax.xml.</Item>
>                         <Item>org.mortbay.</Item>
>                         <Item>org.xml.</Item>
>                         <Item>org.w3c.</Item>
>                         <Item>org.apache.commons.logging.</Item>
>                         <Item>org.apache.log4j.</Item>
>                         <Item>org.slf4j.</Item>
>                 </Array>
>         </Set>
>
>         <Set name="serverClasses">
>                 <Array type="java.lang.String">
>                         <Item>org.mortbay.jetty.</Item>
>                         <Item>org.mortbay.start.</Item>
>                         <Item>org.mortbay.stop.</Item>
>                 </Array>
>         </Set>
> </Configure>
> ============================
>
> Create a servlet which will forward all requests to a SessionBean on
> the JBoss Server:
> ============================
> public class RemoteEJBProxyServlet extends RemoteServiceServlet {
>
>         protected InitialContext ctx;
>
>         @Override
>         public void init() throws ServletException {
>
>                 super.init();
>
>                 try {
>                         this.ctx = new InitialContext();
>                 } catch (Exception e) {
>                         System.err.println(e.getMessage());
>                         throw new ServletException("Could not create 
> InitialContext", e);
>                 }
>         }
>
>         @Override
>         public String processCall(String payload) throws
> SerializationException {
>                 try {
>                         // Get the session bean
>                         Object bean = ctx.lookup("<The JNDI name of your 
> SessionBean>");
>
>                         // Decode the request and test if it is legal
>                         RPCRequest rpcRequest = RPC.decodeRequest(payload, 
> bean.getClass(),
> this);
>
>                         // Invoke the requested method on the bean and return 
> the encoded
> (=RPC serialized) result
>                         return invokeAndEncodeResponse(bean, rpcRequest,
> rpcRequest.getSerializationPolicy());
>
>                 } catch (NamingException ex) {
>                         ex.printStackTrace();
>                         return RPC.encodeResponseForFailure(null, new 
> Exception
> (ex.getMessage()));
>
>                 } catch (IncompatibleRemoteServiceException ex) {
>                         ex.printStackTrace();
>                         return RPC.encodeResponseForFailure(null, ex);
>                 }
>
>         }
>
>         private String invokeAndEncodeResponse(Object target, RPCRequest
> rpcRequest, SerializationPolicy serializationPolicy) throws
> SerializationException {
>
>                 String responsePayload;
>
>                 Method method = rpcRequest.getMethod();
>                 Object[] args = rpcRequest.getParameters();
>
>                 try {
>                         Object result = method.invoke(target, args);
>                         responsePayload = 
> RPC.encodeResponseForSuccess(method, result,
> serializationPolicy);
>                 } catch (IllegalAccessException e) {
>                         throw new SecurityException(e);
>                 } catch (IllegalArgumentException e) {
>                         throw new SecurityException(e);
>                 } catch (InvocationTargetException e) {
>                         Throwable cause = e.getCause();
>                         responsePayload = 
> RPC.encodeResponseForFailure(method, cause,
> serializationPolicy);
>                 }
>
>                 return responsePayload;
>         }
>
> }
>
> ============================
>
> Also make sure that the J2EE Server libraries are included in the
> Eclipse Run Configuration of your GWT Development Mode.
> These are needed by Jetty to connect to the J2EE Server.
> In the case of JBOSS these are all of the JAR files in "<JBOSS-DIR>/
> client" and "<JBOSS-DIR>/common/lib".
>
> Greetz,
>
> Menno.
>
> On 7 jan, 17:31, mariyan nenchev <[email protected]> wrote:
>
>
>
> > Could you give us small step by step guide how to make gwt 2.0 development
> > mode working with gwt RPC and JBoss ejb beans? I never got it to work.
> > On Thu, Jan 7, 2010 at 5:47 PM, Fushion <[email protected]>wrote:
>
> > > Well, I started about 2 years ago, just a few hours a month trying out
> > > various GWT things and gradually upgrading to newer GWT versions (1.3
> > > - 1.4 - 1.5 - 1.6 - 1.7 - 2.0).
>
> > > Upgrading was always easy as I found out. The only hard part was
> > > getting Jetty to communicate with my JBoss application server in
> > > developmode, but that seems to work just fine now.
> > > Debugging is a lot easier now that OOPHM is implemented in 2.0. I
> > > would REALLY encourage people to start using it as it makes developing/
> > > debugging in various browser simulatious a no brainer and saves a lot
> > > of time! I only have to start the development-mode once a day and
> > > start 4 browsers to connect to it.
>
> > > Most time is spend on CSS styling, as that is still the main problem
> > > when developing for web browsers today.
> > > The page is still in quirks mode (transitional html) as I found out
> > > that it gives me the most consistent UI on all browsers I tested on
> > > (IE6, IE7, IE8, Firefox, Chrome and Safari).
> > > One of the future improvements will be to set the page in standards
> > > mode (html or xhtml), but my first impression on that is that IE7 is
> > > very buggy in that area, especially when trying to do a centered
> > > layout. I hope MS will give IE7 a firm kick out of the browser
> > > world... ;-)
>
> > > The game still uses a lot of pre 2.0 options, but this will be
> > > upgraded over the next weeks (e.g. *LayoutPanels, more UiBinding and
> > > ClientResource integration ).
>
> > > The GWT things that you are able to see in the game include:
> > > - GlassPanels (in various ways)
> > > - Timers
> > > - RunAsync
> > > - Popups
> > > - History management
> > > - GWT RPC (no deRPC yet...)
> > > - Paging tables
> > > - ImageBundles (still pre 2.0)
> > > - MenuBar
>
> > > If I had all the tools and ideas I used in the game at the beginning
> > > of development, I estimate that it would have taken me 2-3 months full
> > > time to develop it (client AND server code, don't underestimate your
> > > server coding....)
>
> > > Menno.
>
> > > On 7 jan, 11:28, mariyan nenchev <[email protected]> wrote:
> > > > Nice.
> > > > How much time the game took to be designed and developed?
>
> > > > On Thu, Jan 7, 2010 at 3:40 AM, Fushion <[email protected]
> > > >wrote:
>
> > > > > I started playing around with GWT since version 1.3 just fooling
> > > > > around with the code and trying out some various things.
> > > > > One thing I did was starting to develop a browser game, so I could see
> > > > > how things worked out in a real application instead of just mocking up
> > > > > some fancy gadgets.
>
> > > > > Well, one thing led to another and now it is starting to look like an
> > > > > actual application.
> > > > > You can find it onhttp://lacesfirst.com
>
> > > > > It is an online football manager game where you can manage a football
> > > > > team.
> > > > > You can train players, hire employees, change formations and tactics,
> > > > > sell/buy players, change the lineup of your team, upgrade your 
> > > > > stadium/
> > > > > shops etc.
> > > > > The games are simulated every day at specified times and take into
> > > > > account the tactics and linup of your team (and the opponents' team).
> > > > > The teams and players are all fictional and randomly generated, as
> > > > > there is no way I want to get into licencing troubles with the NFL
> > > > > ofcourse.
>
> > > > > One thing to notice is that the entire game (client and server code)
> > > > > is made of 100% Java (Using EJB3on server side).
> > > > > This made it possible to have just one servlet containing about 40
> > > > > lines of code that just calls a SessionBean on the EJB server.
> > > > > Also the code of the data model is used in both client and server
> > > > > side, so no extra DTO objects were needed.
> > > > > All this makes the code very slim and manageble.
> > > > > It is not exactly a UI that you would find in a typical GWT
> > > > > application though...
>
> > > > > The game is still in beta as there are many things that can be made
> > > > > better, but it is playable anyway.
> > > > > Have fun!
>
> > > > > Greetz,
>
> > > > > Menno.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google Web Toolkit" group.
> > > > > To post to this group, send email to
> > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-web-toolkit%2Bunsubs
> > > > >  [email protected]><google-web-toolkit%2Bunsubs
> > > [email protected]>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-web-toolkit%2Bunsubs
> > >  [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to