how to run gwt newer version in netbeans

270 views
Skip to first unread message

Vineet Jaiswal

unread,
May 15, 2020, 5:26:52 AM5/15/20
to GWT Users
can any body provide any solution for the following:

currently we are using GWT 2.6.1 version with old firefox 24 version (to view output) because only this browser version support source index debugging.

now we want to upgrade to newer versions of gwt but GWT4nb pluging for netbeans using by us is not supporting source index debugging for browsers.

how can we use newer version of gwt in netbeans with client side debugging enabled. we are using payara, glassfish server.




Dr. Lofi Dewanto

unread,
May 15, 2020, 6:23:03 PM5/15/20
to GWT Users
I would prefer just using:

(1) Maven for everything, never depends on IDE plugins, you can use GWT Maven plugin to run the transpiler and serve the HTML + JS files, no need to use plugin. 
(2) For debugging I'm using Chrome and it has a very good source map debugger.
(3) Best practice, never mix client- and server-side. Make a stand-alone Maven project for your client-based webapp / webbrowser.

Take a look at this presentation for the anatomy of GWT webapps: https://bit.ly/gwtintropresentation

Hope this helps,
Lofi

Vineet Jaiswal

unread,
May 16, 2020, 2:42:24 AM5/16/20
to GWT Users
thank you Dr. Lofi for your quick response. the presentation is very helpful.

but there are few hurdles in using maven:

1. the team has expertise in netbeans. they don't now how to use maven. to use it first we have to arrange the training sessions.
2. company do not allow to move the code out of the company premises. they want the whole code to be kept only on there company server.
   
again I request, is there any way that we could continue netbeans. 


secondly! as you said never mix client- and server-side.
can you share any small example where we could see how we can keep client and server-side separately in gwt. 
because we are using the base architecture of gwt: 

example: 

-demo.home.client 
  -Home.java

-demo.home.server
  -Home_ServerImpl.java

-demo.home.shared
  -Home_Model.java
  -Home_RemoteService.java
  -Home_AsyncService.java


demo.home.shared.Home_RemoteService.java (class)
public interface Home_RemoteService extends RemoteService {

    public List<Home_Model> getHome(String id, boolean flag);
}

demo.home.shared.Home_AsyncService.java (class)
public interface Home_AsyncService {

    public void getHome(String id, boolean flag, AsyncCallback<List<Home_Model>> result);
}

demo.home.shared.Home_Model.java (class)
public class Home_Model implements Serializable, IsSerializable {

    private String name, address, ............;
    
    public getter & setters ............;

}

demo.home.server.Home_ServerImpl.java (class)
public class Home_ServerImpl extends RemoteServiceServlet implements Home_RemoteService {

    @Override
    public List<Home_Model>> getHome(String id, boolean flag) {
           ........................;
           ........................;
           ........................;
           ........................;
           return listHome_Model;

}

demo.home.client.Home.java (class)
public class Home implements IsWidget, ClickHandler {

    private final ServiceInvoker<Home_AsyncService> srvAsync;

    public Home() {
        srvAsync = new ServiceInvoker<Home_AsyncService>(GWT.create(Home_RemoteService.class), "Home");
    }

    public button_click() {

        srvAsync.getHome(id, flag, new AsyncCallback<List<Home_Model>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        ......................;
                        ......................;
                    }

                    @Override
                    public void onSuccess(List<Home_Model> result) {
                        ......................;
                        ......................;
                        ......................;
                        ......................;
                    }
         });
    }
}
 


* we have many Home_Model.java like classes which hold many common functions that we use both server & client side.

please suggest the architecture to separate the client & server side code in GWT. 

Gordan Krešić

unread,
May 16, 2020, 6:44:45 AM5/16/20
to google-we...@googlegroups.com
On 16. 05. 2020. 00:23, Dr. Lofi Dewanto wrote:
> I would prefer just using:
>
> [...]
> (3) Best practice, never mix client- and server-side. Make a stand-alone
> Maven project for your client-based webapp / webbrowser.

Could you elaborate this a bit further, please?

IMHO, sharing codebase between client and server, especially domain model
which is really easy to make compatible on both ends, it one of the main
benefits in using GWT. Even further, I'm advising mixed Java/JavaScript
teams to use GWT to export ther domain model as a JS lib to be consumed by
frontend developers which use Angular/React/whatever.

-gkresic.

Thomas Broyer

unread,
May 16, 2020, 7:51:45 AM5/16/20
to GWT Users


On Saturday, May 16, 2020 at 12:44:45 PM UTC+2, Gordan Krešić wrote:
On 16. 05. 2020. 00:23, Dr. Lofi Dewanto wrote:
> I would prefer just using:
>
> [...]
> (3) Best practice, never mix client- and server-side. Make a stand-alone
> Maven project for your client-based webapp / webbrowser.

Could you elaborate this a bit further, please?

IMHO, sharing codebase between client and server, especially domain model
which is really easy to make compatible on both ends, it one of the main
benefits in using GWT.

It's not about separating codebases, but separating dependencies/classpaths, to make sure server-side dependencies won't conflict with GWT's own dependencies (e.g. Hibernate Validator, ECJ, Jetty, etc.)
Lofi should probably have said "distinct submodule" rather than "stand-alone project".

Vineet Jaiswal

unread,
May 19, 2020, 2:11:45 AM5/19/20
to GWT Users
sorry for delay..

I couldn't understand.

There was two questions:

1. how to use GWT in netbeans with source index debugging

2. and second is what lofi suggested. please explain by giving any small example if possible.

please help! we are not able to run GWt in netbeans.   

Frank Hossfeld

unread,
May 19, 2020, 3:44:13 AM5/19/20
to GWT Users
You can generate a ready to use Multi Module maven project using TB GWT-Maven-Plugin here: http://www.mvp4g.org/boot-starter-nalu/BootStarterNalu.html

Once you have generate the project, you can import it as a Maven project into your IDE (did not test it with NetBEans, but expect it is working). Now, follow the the instructions of the readme.txt and start codeserver and jetty.

paste the URL into your browser (chrome) and hit return. 

Once running open the dev tools, move to sources and start debugging.

Dr. Lofi Dewanto

unread,
May 19, 2020, 4:13:24 PM5/19/20
to GWT Users
Sorry it is just what Thomas said, you need to separate into following Maven / project modules:

(1) API: the interface between Client and Server module
(2) Server: where the server be implemented (Spring Boot, Quarkus, Servlet GWT,..). This module could implement the API module.
(3) Client: where the GWT webapp implemented. This module implements the API module as well.

As a simple example take a look at this project, it also has an explanation on those modules:

As an alternative you could just use the Maven generator from Thomas plugin (see Thomas comment),

For a bad example you can take a look at this project:

The package structure is completely correct but I put everything in ONE Maven project which is not good because you could have chaos in the classpath like Thomas said. I was lucky at that time to be able to put everything running (Spring Boot, GWT, etc.), but today maybe not anymore since Spring Boot add maybe new Jetty, etc.

Hope this helps.
Lofi

Dr. Lofi Dewanto

unread,
May 19, 2020, 4:31:44 PM5/19/20
to GWT Users
Using Maven does not mean that you have to put your software product as Open Source. So you can still do everything in house.

For sure you need to teach the devs to build the software with Maven but NetBeans has a very good Maven support: 

Using Maven in NetBeans is actually quite straight forward... and using Maven does not mean that you don't use NetBeans anymore:
- Maven is a tool to do the build and libs dependencies for your app
- NetBeans is an IDE and it can use Maven natively within NetBeans just like Eclipse / IntelliJ / VisualStudio Code

Now to your example:

You have "client", "server" and "shared" (I always use the term API for "shared") which is correct, see my example: https://github.com/interseroh/demo-gwt-springboot
It looks the same as your structure.

BUT

I assume that you have those packages just in ONE NetBeans project, just like my example above (https://github.com/interseroh/demo-gwt-springboot/tree/master/src/main/java/com/lofidewanto/demo).

... and this is the problem: since you mixed the client and server classpath together in one NetBeans project. If you have a newer version of Jetty for your server module, your GWT transpiler would maybe stop to work. Therefore you need to separate them into THREE NetBeans projects:

(1) "client" project
(2) "shared" project
(3) "server" project

... so they have their own classpath.

The problem is now: you need Maven to handle the dependencies:

(1) client depends on shared
(2) server depends on shared
(3) No dependencies between client and server

Surely you could build 3 projects in NetBeans and put the Jar manually into the libs directory or put it as dependency within NetBeans but that's more manual work than just using Maven.

Hope this helps.
Lofi

Vineet Jaiswal

unread,
May 21, 2020, 2:20:37 AM5/21/20
to GWT Users
thank you lofi..

i will try this and then get back to you..
hope it will solve my problem.  
Reply all
Reply to author
Forward
0 new messages