Deploying Vosao from Eclipse

Deploying Vosao from Eclipse

At last! Java SDK, Eclipse, Maven, SVN... everything in place to finally deploy Vosao from Eclipse. During the configuration of Vosao project inside Eclipse I've found multiple errors and warnings, unfortunately you may find others. However, if you have configured your workspace in a similar or exact way as I did with the "work area", it is very likely that you will find the same errors and warnings, making this post much more helpful to you.

Having Vosao project running on a local server instance will allow us to debug through its source code. To do so, we need the Google Plugin for Eclipse, this plugin installs among other things an embedded version of Jetty Servlet Container which allow us to effortlessly deploy web applications locally.

This post is a bit too long, I know, but I prefer to write long explanations than lack of clarity. Nothing else to say, I'm waiting expectantly to see if that post is a great help to you...


Required software that has already been installed and configured.

Installation steps

You will also need the Google Plugin for Eclipse, but I have decided not to write a post about installing it because it is so easy and so well explained at its official web page that it would be a waste of time to "Copy & Paste" the same content in this blog.

Step 1 - Synchronizing with Vosao repository

This part is very similar to the Test section done at the post explaining how to install Subclipse, the SVN Eclipse plugin. We need to set up a new SVN repository though, so start Eclipse and go to Window > Open Perspective > Other... and select SVN Repository Explorer. From this perspective, inside the "SVN Repositories" view, we must add a new Repository Location.. with the following URL:

Checkout the HEAD revision of VosaoDownloading the whole Vosao project.

Accept the default configuration (project name: vosaocms, Check out HEAD revision, Allow unversioned obstructions) by clicking Next and select your default workspace location (e.g. home/me/lab/workspace). Right-click on the newly added repository and Checkout..., wait until the project is downloaded. By the way, we have finished with this perspective, we can now switch to the Java EE perspective.

Step 2 - Import as Maven projects

There it is! the vosaocms project. Forget about the errors and warnings, before worrying about them we need to fix something else. Eclipse has downloaded the project, but it has not imported it as a Maven managed project. To fix this issue we need to delete the project from Eclipse, do not check the option Delete project contents on disk. With the project deleted there are no errors neither warnings, as I said, we shouldn't worry about them yet ;-P (sorry about that). All right, project removed, now go to File > Import... and inside Maven select Existing Maven Projects.

A configuration window is displayed, set the field Root Directory navigating through your filesystem and selecting the folder ~/lab/workspace/vosaocms. The list below should display the 3 modules that compose the project, select all of them if they are not already selected and click on Finish.

Setting Vosao as a Maven managed project.Set root directory and select Maven modules to import.

Maven will start Importing Maven projects... and downloading the required dependencies defined inside the POMs. Since I am working with a fresh installation of Maven it needs to download a lot of dependencies. This task will take a long time, so rather than suggest you to have a coffee break I will recommend you to sow your own coffee seeds, water them periodically and wait until they grow up, pick the beans, roast it, grind it and prepare a cup yourself. While drinking your own made coffee all the processes will finish and we will focus on solving the errors and warnings.

Step 3 - Solving errors and warnings

The number of errors and warnings may differ, few months ago I got 33 errors and 43 warnings, but today I’m getting 32 errors and 43 warnings. Anyway, I will try to solve the most usual problems you may find.

Errors & warningsErrors & warnings from a freshly maven imported Vosao project.
Compiler version

First of all, I want to fix an annoying warning: "Java Build Path Problems". To resolve this warning we need to change the J2SE-1.5 JRE library from the build path and replace it with the Java 6 JRE library.

Inside Project Explorer view select vosao-web project, right-click on it and select properties.... At Java Build path section, select Libraries tab and double-click on JRE System Library [j2SE-1.5], there we must change the current selected system library to Workspace default JRE. Click on Finish and Eclipse will update the build path and compile the project again.

Project Facet

Next on the list: "Java compiler level does not match the version of the installed Java project facet. (Java Version Mismatch)". Go to the Project Explorer view of the Java EE perspective, right-click the project vosaocms and select properties.... Select the Project Facets page in the properties window and change the value of Java to 1.6.

The proposed hierarchical structure of the BlogChange the Java version in Project Facets

Facets define characteristics and requirements for Java EE projects, so changing the version from 1.5 to 1.6 is not the best way to fix this error but probably the fastest.

Resources not found

It looks like tests classes are unable to find some classes located under the main folder. This is happening in two modules, the vosao-api and vosao-kernel modules. To fix that, open the properties... of each module and go to Java Build Path section. Inside the Source tab, drop down the node "vosao/source/main/java", select Exclude:** and press the Remove button. I don't know why the source folder was being excluded (probably an import issue).

Last 2 errors

We are going to fix them at once,
The appengine-web.xml file is missing /vosaocms/web/target/vosaocms
The web.xml file does not exist /vosaocms/web/target/vosaocms
Both files are under the target folder, so it is normal that they don't exist as we didn't launch Maven yet. We will be launching Maven frequently so it is a good idea to create a shortcut to launch it. Go to Project > Run Configuration... and select Maven build..., we will set up the run configuration to launch a maven clean install and skip the tests (see image above). This command will traverse into all of the subprojects and run clean, then install.

The proposed hierarchical structure of the BlogRun configuration for Vosao

I have decided to skip tests to make it faster and more important, because they fail*. Launch it, and once it finishes make a Project > Clean... to make Eclipse aware about the new files under the target folder.

*we won’t care, not today.

[INFO] Building war: /home/me/lab/workspace/vosaocms/web/target/vosaocms.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ vosao-web ---
[INFO] Installing /home/me/lab/workspace/vosaocms/web/target/vosaocms.war to /home/me/.m2/repository/org/vosao/vosao-web/0.9/vosao-web-0.9.war
[INFO] Installing /home/me/lab/workspace/vosaocms/web/pom.xml to /home/me/.m2/repository/org/vosao/vosao-web/0.9/vosao-web-0.9.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] Vosao CMS ......................................... SUCCESS [4.877s]
[INFO] Vosao CMS java api ................................ SUCCESS [24.877s]
[INFO] Vosao CMS java kernel ............................. SUCCESS [18.272s]
[INFO] Vosao CMS web module .............................. SUCCESS [45.760s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:36.049s
[INFO] Finished at: Mon Jul 18 23:39:38 CEST 2011
[INFO] Final Memory: 10M/47M
[INFO] ------------------------------------------------------------------------
Output from launching maven...SUCCESS, SUCCESS, SUCCESS, SUCCESS :-)
New error

Ouch! A new error has appeared. This is a weird one, sometimes Eclipse says that the output directory for the project should be set to /vosaocms/web/target/vosaocms, others to /vosaocms/web/target/vosaocms/WEB-INF/classes. Nevermind, the right directory is the one which contains the war file. Open vosaocms properties, access Google > Web Application and set the path to web/target/vosaocms. If the directory is already set to the correct path, you might try changing it and setting it back again to let Eclipse know about that. Click Ok and now we can say it high and clear...we got 0 errors!! :-)


Here we go! Right-click on vosaocms project and Run As... > Web Application

Jul 21, 2011 10:01:33 PM info
INFO: Logging to JettyLogger(null) via
Jul 21, 2011 10:01:35 PM readAppEngineWebXml
INFO: Successfully processed /home/me/lab/workspace/vosaocms/web/target/vosaocms/WEB-INF/appengine-web.xml
Jul 21, 2011 10:01:35 PM readConfigXml
INFO: Successfully processed /home/me/lab/workspace/vosaocms/web/target/vosaocms/WEB-INF/web.xml
Jul 22, 2011 12:01:46 AM start
INFO: The server is running at http://localhost:8888/
Console output when launching Vosao from Eclipse

Launch your browser and access Vosao CMS web application at http://localhost:8888/

[ERROR] BaseDaoImpl - -Config for site was not found!
[ERROR] BaseDaoImpl - -Config for site was not found!
[INFO] SetupBeanImpl - -setup...
[INFO] AbstractSubscriber - -Added new session clean task
[INFO] AbstractSubscriber - -Deleted 0 sessions.
[INFO] AbstractSubscriber - -Finished session cleaning.
[INFO] SetupBeanImpl - -Adding admin user
[INFO] SetupBeanImpl - -Adding default template.
[INFO] SetupBeanImpl - -Adding default folders.
[ERROR] BaseDaoImpl - -Config for site was not found!
[INFO] SetupBeanImpl - -Added Home page
[INFO] SetupBeanImpl - -Added Site user Login
[INFO] SetupBeanImpl - -Added Search
[ERROR] BaseDaoImpl - -Form config for site was not found!
[INFO] SiteFilter - -Setup was successfully completed.
[INFO] AbstractSubscriber - -Import default.vz 1  0
1424 [9218220@qtp-867695-3] INFO org.jabsorb.reflect.ClassAnalyzer - analyzing org.vosao.service.front.impl.SearchServiceImpl
1458 [9218220@qtp-867695-3] INFO org.jabsorb.localarg.LocalArgController - registered local arg resolver org.jabsorb.localarg.impl.HttpServletRequestArgResolver for local class javax.servlet.http.HttpServletRequest with context javax.servlet.http.HttpServletRequest
1461 [9218220@qtp-867695-3] INFO org.jabsorb.localarg.LocalArgController - registered local arg resolver org.jabsorb.localarg.impl.HttpServletResponseArgResolver for local class javax.servlet.http.HttpServletResponse with context javax.servlet.http.HttpServletResponse
1465 [9218220@qtp-867695-3] INFO org.jabsorb.localarg.LocalArgController - registered local arg resolver org.jabsorb.localarg.impl.HttpSessionArgResolver for local class javax.servlet.http.HttpSession with context javax.servlet.http.HttpServletRequest
1467 [9218220@qtp-867695-3] INFO org.jabsorb.localarg.LocalArgController - registered local arg resolver org.jabsorb.localarg.impl.JSONRPCBridgeServletArgResolver for local class org.jabsorb.JSONRPCBridge with context javax.servlet.http.HttpServletRequest
1469 [9218220@qtp-867695-3] INFO org.jabsorb.reflect.ClassAnalyzer - analyzing org.vosao.service.front.impl.LoginServiceImpl
1562 [9218220@qtp-867695-3] INFO org.jabsorb.reflect.ClassAnalyzer - analyzing org.vosao.service.front.impl.ChannelApiServiceImpl
1563 [9218220@qtp-867695-3] INFO org.jabsorb.reflect.ClassAnalyzer - analyzing org.vosao.service.front.impl.CommentServiceImpl
1570 [9218220@qtp-867695-3] INFO org.jabsorb.reflect.ClassAnalyzer - analyzing org.vosao.service.front.impl.FormServiceImpl
[INFO] AbstractSubscriber - -Import finished. 198
Console output while accessing the CMS for the first time.

And there it is! the setup page of Vosao CMS.



blog comments powered by Disqus


Post Sharing