GWT.log at server side??? Bad idea.

:)

2009/3/14 144_genting <[email protected]>

>
> Hi all, i am new to the gwt http servlet mechanism and really really
> need some help. i know that GWT cannot support some of the java
> classes, so had to use their request builder instead. i got a class
> not found exception, but is not sure whats wrong! help is really
> appreciated!
>
> yup and does anyone know of a full step by step tutorial with the
> server side codes as well?
> would be great if there was one to follow thru.
>
> --------------client side---------
> public class Testing4 implements EntryPoint {
>
>        public void onModuleLoad() {
>                // TODO Auto-generated method stub
>
>                String url = "login?login=3&password=3";
>                RequestBuilder builder = new RequestBuilder
> (RequestBuilder.GET,
> URL.encode(url));
>
>                try {
>                        //RequestBuilder builder = new RequestBuilder
> (RequestBuilder.GET,
> "login");
>                        builder.sendRequest("", new RequestCallback()
> {
>                                public void onResponseReceived(Request
> request, Response response)
> {
>
>                                         if (200 ==
> response.getStatusCode()) {
>                                          // Process the response in
> response.getText()
>
>                                                 Window.alert("the
> string: "+ response.getText());
>                                      } else {
>                                        // Handle the error.  Can get
> the status text from
> response.getStatusText()
>                                          Window.alert(" Connected
> with error(maybe)");
>                                      }
>
>                                }
>                                public void onError(Request request,
> Throwable exception) {
>                                        Window.alert("Error ("+
> exception +")"); } });
>                        } catch(RequestException exception) {
>                                Window.alert("Wooops ("+ exception
> +")"); }
>        }
>
> }
>
> --------------server side------------------------
>
> public class LoginServlet extends HttpServlet {
>        private static final long serialVersionUID = 1L;
>
>        /**
>         * @see HttpServlet#doGet(HttpServletRequest request,
> HttpServletResponse response)
>         */
>        protected void doGet(HttpServletRequest req,
> HttpServletResponse
> resp) throws ServletException, IOException {
>                String login = (String) req.getParameter("login");
>                String password = (String) req.getParameter
> ("password");
>                System.out.println("Login: "+ login +"/"+ password);
>                GWT.log("Login: "+ login +"/"+ password, null);
>
>                Document doc = XMLParser.createDocument();
>                Element root;
>                if(login != null && !login.equals("") && login.equals
> (password)) {
>                        root = doc.createElement("loginSuccessful");
>                        root.setAttribute("login", login.toUpperCase
> ()); }
>                else {
>                        root = doc.createElement("loginFailed");
>                        Element causes = doc.createElement("causes");
>                        Element cause;
>                        if(login == null || login.equals("")) {
>                                cause = doc.createElement
> ("loginIsEmpty"); }
>                        else { cause = doc.createElement
> ("loginAndPasswordDontMatch"); }
>                        causes.appendChild(cause);
>                        root.appendChild(causes);
>                        }
>                doc.appendChild(root);
>                resp.setContentType("text/xml");
>                System.out.println(doc.toString());
>                resp.getOutputStream().print(doc.toString());
>        }
>
>        /**
>         * @see HttpServlet#doPost(HttpServletRequest request,
> HttpServletResponse response)
>         */
>        protected void doPost(HttpServletRequest request,
> HttpServletResponse
> response) throws ServletException, IOException {
>                // TODO Auto-generated method stub
>        }
>
> }
>
> --------------------xml file----------------------------------
> <module>
>
>        <!-- Inherit the core Web Toolkit stuff.                  -->
>        <inherits name='com.google.gwt.user.User'/>
>
>        <inherits name="com.google.gwt.xml.XML"/>
>        <inherits name="com.google.gwt.http.HTTP"/>
>
>        <!-- Specify the app entry point class.                   -->
>        <entry-point class='com.mycomapny.mypackage.client.Testing4'/>
>
>        <inherits name="com.google.gwt.user.theme.standard.Standard"/>
>        <!-- <inherits name="com.google.gwt.user.theme.chrome.Chrome"/
> > -->
>        <!-- <inherits name="com.google.gwt.user.theme.dark.Dark"/> --
> >
>
>        <servlet path="/login"
> class="com.mycompany.mypackage.server.LoginServlet"/>
>
> </module>
>
> -----------------------exception ------------------------------
>
> [ERROR] Unable to instantiate
> 'com.mycompany.mypackage.server.LoginServlet'
> java.lang.ClassNotFoundException:
> com.mycompany.mypackage.server.LoginServlet
>        at java.net.URLClassLoader$1.run(Unknown Source)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Unknown Source)
>        at
> com.google.gwt.dev.shell.GWTShellServlet.tryGetOrLoadServlet
> (GWTShellServlet.java:936)
>        at com.google.gwt.dev.shell.GWTShellServlet.service
> (GWTShellServlet.java:277)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
> 802)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
>        at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:157)
>        at org.apache.catalina.core.StandardWrapperValve.invoke
> (StandardWrapperValve.java:214)
>        at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>        at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>        at
> org.apache.catalina.core.StandardContextValve.invokeInternal
> (StandardContextValve.java:198)
>        at org.apache.catalina.core.StandardContextValve.invoke
> (StandardContextValve.java:152)
>        at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>        at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>        at org.apache.catalina.core.StandardHostValve.invoke
> (StandardHostValve.java:137)
>        at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>        at org.apache.catalina.valves.ErrorReportValve.invoke
> (ErrorReportValve.java:118)
>        at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:102)
>        at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>        at org.apache.catalina.core.StandardEngineValve.invoke
> (StandardEngineValve.java:109)
>        at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>        at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>        at org.apache.catalina.core.ContainerBase.invoke
> (ContainerBase.java:
> 929)
>        at org.apache.coyote.tomcat5.CoyoteAdapter.service
> (CoyoteAdapter.java:
> 160)
>        at org.apache.coyote.http11.Http11Processor.process
> (Http11Processor.java:799)
>        at org.apache.coyote.http11.Http11Protocol
> $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>        at org.apache.tomcat.util.net.TcpWorkerThread.runIt
> (PoolTcpEndpoint.java:577)
>        at org.apache.tomcat.util.threads.ThreadPool
> $ControlRunnable.run
> (ThreadPool.java:683)
>        at java.lang.Thread.run(Unknown Source)
>
> [ERROR] Unable to dispatch request
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" 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/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to