Hacking Apache Rave I [WIP]

APACHE RAVE

We were watching Apache Rave for a long time, and used it for a few production environments. And while the project is not in stable status it was enough for us. Now it’s time to go action. This is a blog about our adventures…

 

PREPARAING DEV

The first task to do was to clone the repository. I did it some time ago so I just decided to copy the data to a new directory inside Eclipse so I can go in. I used the angular branch because I think is more advanced than trunk. For me, Apache Rave is overbloated and medium weight application so the first task I will do is remove everything that’s broken. But first it must compile and run.

So I created a branch and started to import to Eclipse. I only got the basic needs to run a small copy.

[PUT IMPORT IMAGE]

 

PROBLEMS

The first thing I’ve found is that JPA Entity management relies in an enhacer that will not automagically run under eclipse. While this is okay we need to work around since it’s just needed in runtime to do all transaction management stuff. I must say I hate this feature of JPA and OpenJPA. You can take a look here and here.

 

It seems that Eclipse will not deploy it if you close the project. Even if the dependency exists!!! So I had to work around. In the rave-portal I just created [level2-rave/rave-portal/src/main/webapp/WEB-INF/lib] a directory with the compiled binary inside. And closed the project.

 

NOTE: If you don’t import this dependency in eclipse but just compile it with maven from the command line, you don’t need this step.

 

When it tries to start it fails because there’s no jndi resources for the database connection. I just took a look to the war created by cargo:run and added another file called context.xml under rave-portal-resources/src/main/webapp/META-INF. So it will create the resources when deployed.

<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <Resource name="jdbc/raveShindigDB" type="javax.sql.DataSource" auth="Container" driverClassName="org.h2.Driver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" password="local" url="jdbc:h2:/tmp/rave_db;AUTO_SERVER=TRUE" username="sa"/>
  <Resource name="jdbc/ravePortalDB" type="javax.sql.DataSource" auth="Container" driverClassName="org.h2.Driver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" password="local" url="jdbc:h2:/tmp/rave_db;AUTO_SERVER=TRUE" username="sa"/>
</Context>

 

The last change was to set it in debug mode in log. Changing the file rave-portal-resources/src/main/resources/log4j.xml

Now it seems it runs…

 

IT RUNS BUT DON’T REALLY WORKS

The first problem I found is that you will be unable to log in with Firefox. I don’t know why but it seems something related to spring-security. The second thing is that if you try with chrome you will log in but it will fail.

org.springframework.web.client.HttpClientErrorException: 404 Not Found
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88)
    at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:537)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:493)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
    at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:302)

 

I know this is because shindig is not run. So I have to fix it because is not a mandatory dependency for now. So time to hack.

 

TIME TO HACK

Apache Rave looks promising for me. I love the LDAP and Open ID stuff (but I will not enable it on start as is now), the portal architecture but my really needed features are w3c widget support and the portal itself. But there are things that I hate. The portal is built against JSP and Tiles. A very old technology that makes it hard to hack. More if you work with graphic artists and web developers.

While it’s modular you cannot enable or disable a module without touching all configuration files, and sometimes you don’t really know where to look at.

 

 

FIRST TASK

Fix the error when shindig is not started. I need to remove the need of shindig to be started because the first thing I learnt with rave is that shindig MUST be deployed in context ROOT. And this is a pain in some contexts. So I will try to make it to play fair like wookie does.

 

UPDATE: I sent a patch, waiting for approval

 

SECOND AND MAIN TASK

I will rewrite the interface with Apache Wicket and I will do it to look as a module that you can enable or disable. This way you will be able to run main portal but for people that want to hack it will be a lot easier. But not only that I want:

  1. Support bootstrap
  2. Support themes
  3. Support Dojo
  4. Separate html and web development. I use to set the pages in plain HTML over the webapp directory so everyone will find it. (NOTE: wicket set it in the resources so they are packaged with the solution).
  5. Better window placement inside portal.

 

Time to work!

 

 

 

 

2 thoughts on “Hacking Apache Rave I [WIP]

  1. Nice job dude! I’m trying to compile the source version. I’m getting an error at Ant. it says:

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (generate-and-install-custom-rave-project) on project rave-custom-project-archetype: An Ant BuildException has occured: /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/myproject is not a valid directory
    [ERROR] around Ant part …… @ 33:181 in /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/antrun/build-main.xml
    [ERROR] -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (generate-and-install-custom-rave-project) on project rave-custom-project-archetype: An Ant BuildException has occured: /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/myproject is not a valid directory
    around Ant part …… @ 33:181 in /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/antrun/build-main.xml
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/myproject is not a valid directory
    around Ant part …… @ 33:181 in /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/antrun/build-main.xml
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:355)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    … 20 more
    Caused by: /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/antrun/build-main.xml:33: /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/myproject is not a valid directory
    at org.apache.tools.ant.taskdefs.Java.setupWorkingDir(Java.java:855)
    at org.apache.tools.ant.taskdefs.Java.setupExecutable(Java.java:825)
    at org.apache.tools.ant.taskdefs.Java.fork(Java.java:788)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:327)
    … 22 more
    [ERROR]
    [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/MojoExecutionException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR] mvn -rf :rave-custom-project-archetype

    Could you help me?

    • Hi Renan,
      There are problems depending on what branch do you compile. It’s better to write to the mail list of the project so everyone is aware of the problem and someone will help you. On your case it seems the build system has no access to /Users/renanalencar/Documents/htdocs/rave/rave-custom-project-archetype/target/myproject directory. Maybe beause permissions or maybe because it was not created. You can try creating the directory by hand and retrying. But I would prefer send an e-mail to the maillist. Maybe it’s a bug in other place.

      Thank you for writing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website