Interesting bit of Java technology: Vaadin

So I went to a talk on Vaadin and found it very interesting and very simple.

Basically it’s a Java framework for the web. I found creating a simple website with it to be remarkably easy and a great idea for webapps.

I’ll give a quickie tutorial on setting it up for OpenSuSE. Copy and paste provided below

Now from their website, they show how to set it up using Maven, NetBeans, Eclipse, and other IDEs.

As you may recall, I’ve had some issues with Maven. So…that’s how we’re going to install it.

From the directions on the site, I can get it up and running with:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

However, I ran into some issues with having different versions of Java on my machine. So, let’s go ahead and get started.

We need to again make sure that we have the maven repo and then install it. As root:


zypper addrepo -r http://download.opensuse.org/repositories/devel:tools:building/openSUSE_Leap_42.2/devel:tools:building.repo
zypper in -y maven

Now, let’s run it:

mvn

If you’re like me, then you got this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org.codehaus.plexus.classworlds.ClassWorld
   at java.lang.Class.initializeClass(libgcj.so.17)
   at org.codehaus.plexus.classworlds.launcher.Configurator.configure(Configurator.java:119)
   at org.codehaus.plexus.classworlds.launcher.Launcher.configure(Launcher.java:131)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.VerifyError: verification failed at PC 8 in org.codehaus.plexus.classworlds.ClassWorld:closeIfJava7((Lorg.codehaus.plexus.classworlds.realm.ClassRealm;)V): incompatible type on stack
   at java.lang.Class.initializeClass(libgcj.so.17)
   ...4 more

So let’s fix this by installing the jdk-devel package:

NOTE: Make sure you install the development package that corresponds to your version of java! If you followed the earlier tutorial, then this is 1.7!


zypper in -y java-1_8_0-openjdk-devel

With that done, let’s rerun it:


mvn

and we’ll get:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.223 s
[INFO] Finished at: 2017-05-11T21:25:11-05:00
[INFO] Final Memory: 5M/72M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

Although it says error, this is fine. We didn’t give it any details on what to do.

Now we can follow the above instructions and work from there (as a regular user):


mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

With that said, just navigate your browser to http://127.0.0.1:8080 and you can see the demo app.

I’ll come up with an actual example and put that on the repo and give another entry on how that works later on. Until then, have a lot of fun.

Copy and Paste

As root (make sure you get the correct jdk-devel package, yours may not be 1.7):

zypper addrepo -r http://download.opensuse.org/repositories/devel:tools:building/openSUSE_Leap_42.2/devel:tools:building.repo
zypper in -y maven
zypper in -y java-1_8_0-openjdk-devel

As a regular user:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
cd vaadin-app
mvn package jetty:run

This entry was posted in Computer Science and tagged , , , , . Bookmark the permalink.

Notice: compact(): Undefined variable: limits in /srv/www/vhosts/blog.ceneblock.com/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /srv/www/vhosts/blog.ceneblock.com/wp-includes/class-wp-comment-query.php on line 853

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.