JBoss 5 and Alfresco 3.3 on Mac OS-X

UPDATE 6-13-2010: I gave a go again with the 3.3 community release and figured out how to run the installer. If you get the context menu to popup and pick off open this, and then select to open it with the terminal it will start correctly. Kind of random luck I guess to figure that out. Once I did that the system installed with my MySQL and its own tomcat install. I’m going to try the jboss route again with this database working properly…

ORIGINAL POST:

Unfortunately I got my 17″ PowerBook stolen. Bummer…so all my development tools went with them. Luckily I didn’t have anything too sensitive on that machine, but it is quite a bummer. I have my new machine now – so now I need to install some things. I’ve got some trouble with our Alfresco instance so I’ll be installing MySQL, JBoss 5.1, and Alfresco 3.3 along with IntelliJ to do some investigating. I’ll walk thru the steps in this post.

Alfresco 3.3 is a pretty nice tool for collaborating on documents, however working with MS Office is a constant battle to stay ahead of the latest tricks from Redmond. The latest trick is a change in how documents are opened when downloaded from the web with Internet Explorer. These changes effect Office 2007 products – Word and Excel in particular. When you click on a link to a .doc/docx file IE will start he download and then transfer the download to the app (Word in this case). Word will then perform the download, but since Word has a new browser session, the web session is not there and the download fails. This mechanism in 2007 is a new “feature”.

To resolve the issue I’ll need to get Alfresco installed and check into how the links to documents are formed.

Installing JBoss 5.1 AS

This is pretty simple – but you’d think there could be a simple doc from the community that tells you what the deal is. To get JBoss installed simply download the ZIP file, extract it to your Mac somewhere (I just placed it under my user directory), and then check permissions on the run.sh file. JBoss should startup from a command line from the bin directory simply type executing: ./run.sh – you should do this now and check for any errors.

Installing MySQL

Prior to getting MySQL, make sure you have Xcode and MacPorts installed. After that I Would just follow the instructions here. You can also look at my post on getting Drupal working on OS-X. I have some additional tips on MySQL installation there…ok maybe not. For some reason macports is not working. I keep getting an error – either make is not found or I get missing files – Error 64. I poked around, but found no help. I’ll drop back to doing the install the old fashioned way.

Grab the dmg file from: http://dev.mysql.com/downloads/mysql/

Then mount it and run the installer. Take all the defaults.

These instructions are helpful. After running the installer you should be able to startup mysql with this command from /usr/local/mysql: sudo ./bin/mysqld_safe. When you reboot the server should startup for you. The next question is a tool for creating a database. Those tricky guys at MySQL (or is that Oracle now?) have  eliminated the old GUI tools and now you have to use the “Workbench”.

That’s ok – but it took me a while to figure out that the 5.1 release only does data modeling. After trying to figure out what the heck was wrong for a good two hours – because the MySQL site is already updated for 5.2 but never actually says this anywhere as far as I can tell- I downloaded the 5.2 beta and sure enough there’s a whole bunch of new stuff. You’d think they could put a “hey all the docs on our site assume you are using the beta and not the GA release”. Sheesh….anyway…

Its a decent tool – got my db created and an alfresco user account setup pretty quick. It is nice to have a single tool to do everything, although it is not entirely obvious from the tool when things are committed to the database. A bit freaky to me.

While you are still at the MySQL site might as well download the latest JDBC drivers – called Connector/J. After the download, extract the tar file and just throw that into the main lib folder under your jboss server. Don’t do that in a production setting – put it in a specific server lib directory, but for a local dev server this is fine.

Installing and Starting Up Alfresco

This should be easy – right? Well I downloaded the Mac installer – but the type is not recognized on my Mac – keep in mind this is a pristine and brand new MacBook Pro – there’s no instructions really on the alfresco site to help you out so I guess I have to go to plan B: installing using the WAR file. I grabbed the .WAR file and looked at it – no instructions. There’s a readme.txt that says you can find install instructions on share.alfresco.com. I registered for that, but I don’t see the document library they mention.

So I grabbed the war – extracted it and placed the folder into my jboss server’s deploy directory. I then changed the name of the folder to alfresco.war.

After that you’ll need to edit two files:

  • WEB-INFclassesalfrescorepository.properties – database properties
  • WEB-INFclassesalfrescodomainhibernate-cfg.properties

In repository properties you need to update the jdbc and schema settings for your database. Here’s the JDBC URL I used for MySQL:

db.url=jdbc:mysql://localhost/alfresco2?useUnicode=true&characterEncoding=UTF-8
db.driver=com.mysql.jdbc.Driver

In hibernate-cfg.properties you need to explicitly set the dialect despite what the comment in the file says…or maybe not. See below…

Now you will need to add extra memory to your JAVA_OPTS in the main binrun.conf file for jboss. I used these settings:
-Xms512m -Xmx1024m -XX:MaxPermSize=512m
That should get the stuff to work.

What’s missing in this deal is all the details of how exactly to do this. For starters you’ll need to add your JDBC config information to the repository.properties file located here:
serverdeployalfresco.warWEB-INFclassesalfresco

Here’s the jdbc string I used:
db.driver=com.mysql.jdbc.Driver
db.name=alfresco2
db.url=jdbc:mysql://localhost/alfresco2?useUnicode=true&characterEncoding=UTF-8

Then you will need to check the hibernate config stuff too. I would first try not messing with this file and see if things work. In the end, I think not messing with this file was best. I tried this as a way to eliminate errors but then went back to the original file.

I’ve gotten mired down in the guts of trying to resolve some exceptions when starting up the system. JBoss starts up, I see the schema for alfresco is created ok, but now I am getting some null pointers in the startup log that essentially lead to the app server not deploying the application successfully.

I solved some initial problems with exceptions in the logs by removing several jar files causing conflicts with JBoss’ own jars. These are all the jars related to XML processing. I got of all of the errors , but now I’m stuck with a null pointer error that I cannot resolve:

09:20:18,746 INFO  [STDOUT] 09:20:18,746  INFO  [service.descriptor.DescriptorService] Alfresco started (Community): Current version 3.3.0 (2765) schema 4009 – Originally installed version 3.3.0 (2765) schema 4009
09:20:23,271 INFO  [STDOUT] 09:20:23,271 User:System INFO  [extensions.webscripts.AbstractRuntimeContainer] Initialised Repository Web Script Container (in 791.43ms)
09:20:23,275 INFO  [STDOUT] 09:20:23,273  ERROR [web.context.ContextLoader] Context initialization failed
java.lang.NullPointerException
at org.springframework.extensions.webscripts.ClassPathStore.getDocument(ClassPathStore.java:320)
at org.springframework.extensions.webscripts.DeclarativeRegistry.initWebScripts(DeclarativeRegistry.java:231)
at org.springframework.extensions.webscripts.DeclarativeRegistry.reset(DeclarativeRegistry.java:172)
at org.springframework.extensions.webscripts.AbstractRuntimeContainer.reset(AbstractRuntimeContainer.java:226)
at org.alfresco.repo.web.scripts.RepositoryContainer.init(RepositoryContainer.java:559)
at org.alfresco.repo.web.scripts.RepositoryContainer.reset(RepositoryContainer.java:533)
at org.alfresco.repo.web.scripts.RepositoryContainer$4.doWork(RepositoryContainer.java:487)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at org.alfresco.repo.web.scripts.RepositoryContainer.onApplicationEvent(RepositoryContainer.java:491)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:858)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:419)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)

In the end I have to admit that setting this up on a Mac is a serious hassle compared to either Linux or Windows. Its too bad – the hardware is nice (except for that mouse). The battery life and screen are especially nice. I’ll keep plugging away at this – I’ll get it worked out, but for now I’m jumping back to my Win-doze machine to get the coding I need to do done.

7 Responses

  1. Ryan says:

    As for the XML libraries, even though it is easier to blame OS X than to RTFM, here is a link with the information you need (search for WarClassLoaderDeployer): http://wiki.alfresco.com/wiki/Alfresco_on_JBoss

    • Beren says:

      Yo Ryan – what FM would that appear in? The random link from the alfresco wiki with no index or way to find it from a proper TOC?

      Thanks for the tip however – but as I stated the fix for the XML was pretty simple and not really the problem.

  2. Ryan says:

    The Wiki link was not random, obviously, it directly addresses your comments about having to delete JBoss jars unnecessarily.

    Again, the section from the Wiki link related to WarClassLoaderDeployer:

    -1
    …(omitted)…

  3. Beren says:

    I’m not alone in my criticism of the lack of organization around Alfresco documentation. Finding that specific wiki page amidst the sea of pdf files and pages it not a simple task.

    But your original comment that I was unfairly blaming OS X and not reading a FM is wrong on both points. First off there is no “manual”. Secondly I clearly said the problem with the XML jars was a jboss issue – and my solution did actually work, although the solution in the page you pointed out is better.

    My main complaint in a general way around OS X is the difficulty of getting things in general to work in comparison to Linux and Windows. This is primarily due to lacking documentation or documentation that is difficult to find.

    Either way – I managed to get the solution working on my Mac so now all I have to figure out is how to get the touchpad to work as a two button mouse. I’m sure I can google and find a wiki page with instructions.

  4. Ryan says:

    You said “In the end I have to admit that setting this up on a Mac is a serious hassle compared to either Linux or Windows” after ranting about how you personally decided to try installing MySQL and Alfresco without following the proper installation methods or even performing a simple Google search for multiple paragraphs. In general, anyone who uses Fink/MacPorts and then complains is suspect for the rest of their post anyways.

    I’ve developed in OS X for many years and I have found OS X orders of magnitude easier to manage than either Linux or Windows, specifically because I manage each operating system as it was designed to be managed unless there is a good reason not to do so. For example, I don’t blame Linux when I decide to install something from source and then a future RPM corrupts the installation. I also don’t blame Microsoft when Cygwin causes a problem or a Windows registry change breaks some functionality. It appears that you would.

    For example, in OS X using a DMG to install MySQL is simple. JBoss just needs to be unzipped. And Alfresco is a simple WAR download from their website and a few small configuration changes in JBoss. I don’t see how any of that caused you so many problems and I don’t see how any of that had to do with OS X. I will agree that Alfresco is poorly documented.

    As for the Trackpad, if you are using a recent MacBook Pro (Intel) you can simply enable two/three/four finger trackpad settings and gestures. One finger for “Tap to Click” (left click) and “Dragging”. Two fingers for “Scroll”, “Rotate”, “Pinch Open & Close”, “Screen Zoom” and “Secondary Tap” (right click). Three fingers for “Swipe to Navigate”. Four fingers for “Swipe Up/Down for Expose” and “Swipe Left/Right for Switch Applications”. The Trackpad options are available in System Preferences, no Wiki required.

    Additional tip: Navicat is a great tool for managing MySQL across multiple platforms.

  5. Beren says:

    Good thing its my blog – its my opinion. Yeah to me on windows being able to use a no brains installer is easier than doing all that crap to get Alfresco working on a Mac. Having better documentation for Windows and Linux makes them easier to use.

    OS-X all by itself is a fine OS…and I said I liked the screen and battery life too.

    But for using it as a development machine – not so great simply because its not as well supported. I’m not necessarily “blaming” anyone…simply stating that things can be a hassle. Actually sometimes the same is true of Linux…although sometimes I do blame various Linux distros very various types of suckage.I do think Apple itself contributes to this and tries to force developers towards Apple tools.

    In general I try to be fair and where I am critical and figure out something better I post an update. Which I did in this case 2 months after the original post when I found out that the 3.3 community installer worked right on the Mac. Maybe you didn’t see that?

    oh and thanks for the tip on the track pad – what I’d really like is to be able to click in the lower right/left corner and have that act like a right or left mouse click for opening tabs, getting context menus…like on windows (sigh – can’t believe i said that…) – but yeah…

Leave a Reply