3-tier architecture /gwt

474 views
Skip to first unread message

Assiya EL

unread,
May 2, 2012, 4:05:02 PM5/2/12
to google-we...@googlegroups.com
Hello,

I'd like to cut my gwt project into three projects:
application of 3-tier architecture for example :
->Project contains a customer
-> Project contains hibernate
 -> Project contains my pojo classes
does anyone have a sample project or a tutorial that explains the principle

thank you 

--
 
Assiya EL
Master Qualité du Logiciel 



Plz consider environment - Only print this if necessary


Thomas Broyer

unread,
May 2, 2012, 6:38:39 PM5/2/12
to google-we...@googlegroups.com


On Wednesday, May 2, 2012 10:05:02 PM UTC+2, assiya wrote:
Hello,

I'd like to cut my gwt project into three projects:
application of 3-tier architecture for example :
->Project contains a customer
-> Project contains hibernate
 -> Project contains my pojo classes
does anyone have a sample project or a tutorial that explains the principle

Note sure if that's what you're looking for but have a look at https://github.com/tbroyer/gwt-maven-archetypes which uses 'client' (GWT client-side), 'shared' (POJOs and GWT-RPC interfaces; or if you're using RequestFactory: all the proxies and contexts), and 'server' (server-side; webapp: GWT-RPC/RequestFactory implementation)

Assiya EL

unread,
May 2, 2012, 6:45:51 PM5/2/12
to google-we...@googlegroups.com
thank you for your reply, I'll see it, but I really don't know in  RequestFactory, never used in gwt, I note that I am beginner in gwt 

you can 

2012/5/2 Thomas Broyer <t.br...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/NbbsVUAQgW0J.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Joseph Lust

unread,
May 3, 2012, 10:25:58 AM5/3/12
to google-we...@googlegroups.com
This topic has been discussed on SO and other places.

I am familiar with the suggested GWT archatype, but we found it limiting for large projects. Instead, we (40 devs) use the following Maven project structure to break up our project:

  • MainProject.pom
    • Client-Interfaces.pom (or POJO's as you put it)
    • Client-GWT.pom (frontend GWT code, uses Interfaces)
    • Server.pom (backend Java code, uses Client-Interfaces)
    • Web.pom (Tomcat settings)
So just running the main pom will build the interfaces that are then used by the server side code and the client side GWT. The Web project contains Tomcat specific items and dictates how the war is packed up.
Benefits: You don't need to rebuild the whole project if changes are only in your services. Great because services compile in a few seconds, GWT in several minutes.

In your cases your DAO Hibernate code would go in the Server project.

Sincerely,
Joseph

Thomas Broyer

unread,
May 3, 2012, 11:00:37 AM5/3/12
to google-we...@googlegroups.com
Just a quick note: this is exactly what https://github.com/tbroyer/gwt-maven-archetypes does (except for the server vs. web separation; that's something we did in our project too, but I didn't think it was worth putting into the archetypes: people should just split the module if/when they feel the need for it; I might add it to another archetype though); this is not the same as the archetype from the gwt-maven-plugin!

Juan Pablo Gardella

unread,
May 31, 2012, 8:36:51 PM5/31/12
to google-we...@googlegroups.com
Hi Thomas,

I try to install the archetype but said that:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] gwt-maven-archetypes .............................. SUCCESS [0.344s]
[INFO] modular-webapp .................................... FAILURE [4.469s]
[INFO] modular-requestfactory ............................ SKIPPED
[INFO] guice-rf-activities ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.172s
[INFO] Finished at: Thu May 31 21:33:24 GFT 2012
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.2:integration-test (default-integration-test) on project modular-webapp:
[ERROR] Archetype IT 'basic-webapp' failed: Some content are not equals
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :modular-webapp


Whatt's the problem?

2012/5/3 Thomas Broyer <t.br...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Alexandre Ardhuin

unread,
Jun 1, 2012, 3:09:43 AM6/1/12
to google-we...@googlegroups.com
Hi Juan,

Was you triing with the latest version ?
Could you try to update "gwt-maven-archetypes" ( in gwt-maven-archetypes folder : git pull ) and reinstall the plugin ( mvn clean install ) ?

The latest version works fine for me.

Alexandre


2012/6/1 Juan Pablo Gardella <gardella...@gmail.com>

Thomas Broyer

unread,
Jun 1, 2012, 4:41:30 AM6/1/12
to google-we...@googlegroups.com


On Friday, June 1, 2012 9:09:43 AM UTC+2, Alexandre Ardhuin wrote:
Hi Juan,

Was you triing with the latest version ?
Could you try to update "gwt-maven-archetypes" ( in gwt-maven-archetypes folder : git pull ) and reinstall the plugin ( mvn clean install ) ?

The latest version works fine for me.

Same here. 

Alternately, you could just skip tests: "mvn clean install -Darchetype.test.skip".

archetype:integration-test is very sensible, and the parent POM, being generated/modified by archetype:generate, will *never* have an EOL at EOF. Given that my editors (I use mostly Vim on that project) insist in inserting such an EOL (which is fine the other 99.9% of the time), I have to revert them before launching the tests.
I suppose you could have a similar issue depending on your Git configuration used when cloning the repo (core.eol, core.safecrlf, core.autocrlf).

Juan Pablo Gardella

unread,
Jun 1, 2012, 8:02:04 AM6/1/12
to google-we...@googlegroups.com
Thanks Thomas, Alexandre!

I try with -Dmaven.test.skip but run the test, I didn't know how skip, so I delete the tests :(. Thanks for the tip -Darchetype.test.skip.
After that, I can install and use it. Thanks for both!!

Juan

2012/6/1 Thomas Broyer <t.br...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Juan Pablo Gardella

unread,
Jun 4, 2012, 9:23:18 PM6/4/12
to google-we...@googlegroups.com
Hi,

I have problems to run the project inside eclipse. I add this to the parent pom.xml:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<wtpmanifest>true</wtpmanifest>
<wtpapplicationxml>true</wtpapplicationxml>
<manifest>${basedir}/src/main/resources/META-INF/MANIFEST.MF
</manifest>
<projectNameTemplate>
[artifactId]
</projectNameTemplate>
<wtpversion>2.0</wtpversion>
<workspace>${workspace.path}</workspace>
<downloadSources>true</downloadSources>
</configuration>
</plugin>

So, the project is added as a dependency in the eclipse. With this I can run the client module, I change in shared project, refresh the browser and the changes happens. So I can remove in client module the part where use build-helper-maven-plugin to add sources. I don't know why, but in eclipse doesn't found this sources folder.

The problem that I facing now is, how I can run the server code too inside eclipse? I want to click on Run -> Web application and run in dev mode all modules to test server code too.

If run server module fails because don't found entry module:
Missing required argument 'module[s]'
Google Web Toolkit 2.4.0
DevMode [-noserver] [-port port-number | "auto"] [-whitelist whitelist-string] [-blacklist blacklist-string] [-logdir directory] [-logLevel level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-server servletContainerLauncher[:args]] [-startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir] module[s] 

And if run client module fail because:

[WARN] 404 - POST /app/greet (127.0.0.1) 1395 bytes

And in my server module has:

<servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/app/greet</url-pattern>
  </servlet-mapping>

Can someone help me to run inside Eclipse? 

Thanks,
Juan




2012/6/1 Juan Pablo Gardella <gardella...@gmail.com>
Thanks Thomas, Alexandre!

Thomas Broyer

unread,
Jun 5, 2012, 5:26:35 AM6/5/12
to google-we...@googlegroups.com
I'm still looking for the best / most productive way to do it (see https://plus.google.com/113945685385052458154/posts/3VKPRDU2xZz) but you can simply “Run as… → Maven build…” on the server project, and select the "jetty:start" goal with a “dev” property (set to whatever value, “true” is fine); i.e. the exact equivalent to “cd *-server && mvn jetty:start -Ddev”.

Juan Pablo Gardella

unread,
Jun 5, 2012, 7:31:02 AM6/5/12
to google-we...@googlegroups.com
Thanks Thomas! I will try it

2012/6/5 Thomas Broyer <t.br...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Juan Pablo Gardella

unread,
Jun 5, 2012, 7:53:39 PM6/5/12
to google-we...@googlegroups.com
Thanks Thomas, but is not what I need. I want to run with dev mode, the RPC services for example. In the way that you say, is not dev mode. I will investigate if exists a way to do this (only if I have all in one module)

Cheers,
Juan

2012/6/5 Juan Pablo Gardella <gardella...@gmail.com>

Thomas Broyer

unread,
Jun 5, 2012, 8:36:11 PM6/5/12
to google-we...@googlegroups.com


On Wednesday, June 6, 2012 1:53:39 AM UTC+2, Juan Pablo Gardella wrote:
Thanks Thomas, but is not what I need. I want to run with dev mode, the RPC services for example. In the way that you say, is not dev mode. I will investigate if exists a way to do this (only if I have all in one module)

The archetype is designed to run the server and client code separately, side-by-side: run the server code using "mvn jetty:start -Ddev" (or Eclipse WTP or Sonatype's M2Eclipse Webby) and run the client code in GWT DevMode in -noserver mode (or SuperDevMode).
BTW, SuperDevMode only hosts your client code, so this approach of running server and client separately is "future-proof".
Reply all
Reply to author
Forward
0 new messages