Sunday, December 7, 2008

Jackrabbit Repository Server on JBoss


Updated for jackrabbit 1.5.2



Dependencies:

Jboss 4.2.3

Jackrabbit 1.5.2

Mysql 5.x

jcr-1.0.jar

Maven 2


I'm running JBoss as 4.2.3 on my local PC and I would like to deploy jackrabbit
as a standalone JCR server to create the Repository Server.



In order to have two JBoss servers running on the same box you have to change
the ports of the second server.


Before I updated the ports for the default jboss configuration, I made a copy
of the default directory and called it default-jcr.
I then changed all the ports in default-jcr by appending a 1 in front of the
port name. I used This Document to help identify all the ports.


GOAL: To have a jcr repository server


Get a copy of Jackrabbit. The current version is 1.5.2. Download the source
file and un jar it.



jar -xvf jackrabbit-1.5.2-src.jar
this will create a directory named jackrabbit-1.5.2. I will use to refer to
this directory.

change directory to

modify the following files:

1. /jackrabbit-jcr-rmi/src/main/resources/jackrabbit-rmi-service.xml
and update the RemoteAddress to match the RMI port you changed in the
default-jar jboss configuration.

2. /jackrabbit-jca/deploy/jboss4.x/jcr-ds.xml

jcr/local

jackrabbit-jca-1.5.2.rar

javax.jcr.Repository
/jcr/poc-1.5
/jcr/poc-1.5/repository.xml
true


3. /jackrabbit-jca/target/repository/repository.xml
in this file change the PersistenceManager to use mysql in both places

Repository/PersistenceManager

and

Repository/Versioning/PersistenceManager

In both locations above, be sure that you created an empty database and
created a user in MySQL

build jackrabbit
cd
mvn clean
mvn install

create the directory specified in the jcr-ds.xml above

copy /jackrabbit-jca/target/repository/repository.xml to /jcr/poc-1.5/

copy the following files to the default-jcr configuration

jcr-1.0.jar to default-jcr/lib

mysql-connector-java--bin.jar to default-jcr/lib

jackrabbit-jca-1.5.2.rar to default-jcr/deploy

jackrabbit-jcr-rmi-1.5.0.jar to default-jcr/deploy

jcr-ds.xml to default-jcr/deploy

start Jboss to create the content repository in the directory you specified
above in jcr-ds.xml
run -c default-jcr



Some issues I had in the past


ISSUE


23:26:23,093 WARN [ServiceController] Problem starting service
Jackrabbit.services:RMIServer = JCR RMI Server
javax.naming.CommunicationException: Could not obtain connection to any of
these urls: localhost:1099 and discovery failed with
error: javax.naming.CommunicationException: Receive timed out [Root
exception is java.net.SocketTimeoutException: Receive timed out] [Root
exception is javax.naming.CommunicationException: Failed to connect to
server localhost:1099 [Root exception is
javax.naming.ServiceUnavailableException: Failed to connect to server
localhost:1099 [Root exception is java.net.ConnectException: Connection
refused: connect]]]


SOLUTION


Change C:\jackrabbit-1.4\jackrabbit-jcr-rmi\src\main\resources\jackrabbit-rmi-service.xml
then recompile jackrabbit
cd c:\
cd c:\jackrabbit-1.4
mvn clean
mvn install

replace jackrabbit-jcr-rmi.jar in the deploy-jcr directory with the new file
that was just built.


ISSUE


Issue Using Derby even though I changed the PersistentManager:

here is the portion of the Jboss log that is specific to the start up of
jackrabbit:
00:50:47,906 INFO [RepositoryImpl] Starting repository...
00:50:47,921 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\repository
00:50:48,046 INFO [NodeTypeRegistry] no custom node type definitions found
00:50:48,046 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\version
00:50:49,000 INFO [ConnectionRecoveryManager] Database: Apache Derby / 10.2.1.6 - (452058)
00:50:49,000 INFO [ConnectionRecoveryManager] Driver: Apache Derby Embedded JDBC Driver / 10.2.1.6 - (452058)
00:50:50,312 INFO [RepositoryImpl] initializing workspace 'default'...
00:50:50,312 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\workspaces\default
00:50:50,593 INFO [ConnectionRecoveryManager] Database: MySQL / 5.0.51b-community-nt
00:50:50,593 INFO [ConnectionRecoveryManager] Driver: MySQL-AB JDBC Driver / mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
00:50:50,765 INFO [RepositoryImpl] workspace 'default' initialized
00:50:50,953 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\repository\index
00:50:51,046 INFO [SearchIndex] Index initialized: c:/jackrabbit/poc/repository/index Version: 2
00:50:51,046 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\workspaces\default\index
00:50:51,046 INFO [SearchIndex] Index initialized: c:\jackrabbit\poc\workspaces\default/index Version: 2
00:50:51,046 INFO [RepositoryImpl] Repository started
00:50:51,046 INFO [jcr/local] Created repository (org.apache.jackrabbit.core.RepositoryImpl@110b205)
00:50:51,046 INFO [jcr/local] Created repository handle (org.apache.jackrabbit.jca.JCARepositoryHandle@10f3801)
00:50:51,062 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=jc
r/local' to JNDI name 'java:jcr/local'
00:50:51,218 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=Jm
sXA' to JNDI name 'java:JmsXA'
00:50:51,343 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=PortalDS'
to JNDI name 'java:PortalDS'
00:50:51,437 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=wikiDatas
ource' to JNDI name 'java:wikiDatasource'


SOLUTION


after correcting the repository.xml file: I have achieved using mysql for both
the repository and workspace.

Repository/PersistenceManager

and

Repository/Versioning/PersistenceManager

the schemaObjectPrefix should be different and also the database if you are
using mysql like I am.

Here is the jboss startup log: i'm using Mysql for both repository and
workspace now
01:04:42,203 INFO [RepositoryImpl] Starting repository...
01:04:42,218 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\repository
01:04:42,375 INFO [NodeTypeRegistry] no custom node type definitions found
01:04:42,375 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\version
01:04:42,640 INFO [ConnectionRecoveryManager] Database: MySQL / 5.0.51b-community-nt
01:04:42,640 INFO [ConnectionRecoveryManager] Driver: MySQL-AB JDBC Driver / mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
01:04:42,796 INFO [RepositoryImpl] initializing workspace 'default'...
01:04:42,796 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\workspaces\default
01:04:42,796 INFO [ConnectionRecoveryManager] Database: MySQL / 5.0.51b-community-nt
01:04:42,812 INFO [ConnectionRecoveryManager] Driver: MySQL-AB JDBC Driver / mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
01:04:42,937 INFO [RepositoryImpl] workspace 'default' initialized
01:04:43,093 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\repository\index
01:04:43,218 INFO [SearchIndex] Index initialized: c:/jackrabbit/poc/repository/index Version: 2
01:04:43,218 INFO [LocalFileSystem] LocalFileSystem initialized at path c:\jackrabbit\poc\workspaces\default\index
01:04:43,234 INFO [SearchIndex] Index initialized: c:\jackrabbit\poc\workspaces\default/index Version: 2
01:04:43,234 INFO [RepositoryImpl] Repository started
01:04:43,234 INFO [jcr/local] Created repository (org.apache.jackrabbit.core.RepositoryImpl@1e5ebbf)
01:04:43,234 INFO [jcr/local] Created repository handle (org.apache.jackrabbit.jca.JCARepositoryHandle@8edb84)
01:04:43,234 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=jc
r/local' to JNDI name 'java:jcr/local'
01:04:43,343 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=Jm
sXA' to JNDI name 'java:JmsXA'
01:04:43,406 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=wikiDatas
ource' to JNDI name 'java:wikiDatasource'



ISSUE


Security manager not active


SOLUTION


client.policy & server.policy need to be specifed.
client.policy for the client

server.policy for the JBoss server, set this in the run.bat file


ISSUE


retrieving properties from a RemoteNode class doesn't exist:


SOLUTION


the node Value should be serialized and exist on the server so it
can be unmarshelled before storing to the database. Just include the jar file
containing the extended Value class from when you build the client and
paste it into the JBoss default / lib directory the restart your JBoss server.


ISSUE


Using the JCA connector sessions are not closing properly


SOLUTION


need to add: to the jcr-ds.xml
file (or whatever you called it)


Sunday, March 16, 2008

Roller4 deployed to Weblogic9.2

This is how I got roller installed in weblogic 9.2:

My environment is: MS Windows XP, MySQL 5, MySQL connector java 5. Before you follow what I did, you should download MySQL and install it, create the database as described in the Roller installation guide.

While installing I came across some issues while trying to activate the Roller app. Here is my basic directory structure

webapp/roller
wls9.2_webapp/roller
wls9.2_webapp/roller/data
wls9.2_webapp/roller/data/search-index
wls9.2_webapp/roller/data/themes
wls9.2_webapp/roller/data/uploads
wls9.2_webapp/roller/lib

  1. downloaded Roller and extracted to a location on my hard drive.
  2. I then created a copy of the webapp directory and renamed the new one wls9.2_webapp
  3. Under the new directory I created the following directories: data/ , lib/ .I MOVED the themes directory from the roller directory to the data directory i just created. I then created search-index and uploads directories under the data directory. I now have three directories under data (search-index, themes, uploads). In the lib directory I created the file roller-custom.properties.
  4. Added wls9.2_webapp/roller/lib to the classpath constructed in startwebloic.cmd
  5. Added the connector Java mysql driver to the classpath as well.
  6. Created a new domain and managed server. The admin and managed are one server. For this situation I just used the default port 7001.
  7. Start the weblogic admin server and deploy the directory wls9.2_webapp/roller

Issues that I encountered while trying to activate the roller webapp:
1. mail/Session not found
solution: added WEB-INF/weblogic.xml:



2. java.io.FileNotFoundException: \logs\roller.log
solution: override the roller.log log4j setting by adding the following line to roller-custom.properties. if you are on a PC make sure you escape all the backslash. log4j.appender.roller.File=[path to the logs directory]\\roller.log. You should not see any errors during activation. You can then access: http://localhost:7001/roller. If you never ran Roller before, it would have detected the RollerDB and will notify you that Roller will create the required tables in the empty database. Roller would also detect the DBMS. In my case it stated MySQL.

Wednesday, February 27, 2008

Reject and Renounce

I had to watch the Democratic debate 2/26/2008 @ 9pm est. I'm finally getting the time now to actually follow the race.

I wanted to comment on the fact that Sen. Obama finessed politically everything that was thrown at him. Did you notice how much on screen time he received as well? Finessing is a skill that Sen. Obama is showing on a professional level. I've heard some of the difficult, leading questions in the past that he demonstrated this skill. Every time he is able to identify the "hidden" issue and refocus the conversation.

In last nights case on whether to use Reject or Renounce the support from Farrakhan... either one, he isn't doing it. Sen. Obama made sure that he will do BOTH, Reject and Renounce.

Barack Obama wins!!

-Christopher

Monday, February 25, 2008

Java IDE of choice

Before working on a project and after the design is worked out... There is a final choice that has to be made. What IDE (if any) will I use?

Ideally (If I knew all IDEs before I started a project)
JBoss: JBoss Developer Studio - Eclipse
Sun: NetBeans
WebLogic: WLWorkshop - Eclipse
WebSphere: Eclipse
Everything Else (and all that were mentioned): jEdit

I'm tired... I've created applications that targeted all the mentioned servers. I've been around and tried so many... It is just time to get on with development by sticking to standards based tools to promote productivity. So I have to choose one IDE and get on with it.

I choose: NetBeans!
-Christopher

Monday, January 28, 2008

Maintaining 3 forms in 1 with PHP and javascript

Hi,
I'm working on a project that requires a registration screen. I'm currently using PHP, MySQL, Apache running on Linux (PMAL)... LAMP. My development is on Windows. Ok. The Registration screen supports maintaining a "running" list of entered information. Multiple contact addresses and emergency contacts. I'm not a Graphics Designer but i think i can transition from being a paper artist to a digital one. Before I get to adding graphics, I want to include all functional requirements.

The three forms are available at any time. They are "hidden" in html via style="display:none;" and maintained by javascript I actually used no tables for the interface which i'm proud of. I did read The Art & Science of CSS, and now I'm encouraged to try to adopt some of the techniques outlined in the book, and the chapter on forms was interesting. I switch forms by setting the attribute display:none/block for the form that i need. I have a utility function that clears the current form. I also have other utilities that read the form as well.

Each time the user clicks on the link to persist the entered information I add it to a server side object written in PHP with the same name. Then i clear the form and wait for further input. The persisted information is shown in summary to the user in three different tables on the right side of the screen. Each table represents a PHP object. The table gives the user a visual clue as to how many different records were persisted. The list allows the users also to add and delete a record from the list.

All the information captured from the user will be persisted in the MySQL database when all the registration's minimum requirements are met. Final validation of passwords complete the registration process.

The main components of the registration screens are:
  1. registration.php - presentation
  2. registration.js - javascript related to presentation also contains all ajax methods as well
  3. registration-submit.php - handles final form validation and persistence to database
  4. registration-sucess.php - presentation and confirmation of successful registration
  5. Datasource.php - object to persist the database connection
  6. Object1.php - model - represents one record in the 1st & 2nd, javascript list (records types are saved)
  7. Object2.php - representes one record in the 3rd javascript list.
  8. config/dbconfig.php - contains the database information
  9. config/sysconfig.php - contains specific file system related information for file upload

Sunday, January 27, 2008

Logan Photography

Here is were I establish all the interesting aspects of my life. I'm also a photographer. I enjoy working closely subjects and directing to achieve the desired look. I also have the ability to create an experience that is only achievable by applying my experience and eye for the unique.

My Development Environment

My Development environment includes:
IDEs:
NetBeans 6.0
Dreamweaver 8

Application environments:
JBoss AS 4.2.2.Ga & 5.0.0.Beta2
jdk 1.5.0_10 & 1.6.0_03
Apache 2.0.59
PHP v5.2.3

Databases:
MySQL 5
Oracle XE

I've been using NetBeans for a while now and i'm getting to understand why i really liked advising using a text editor when using putting together new technology. You understand better. The IDE, should help move you along faster but i've been running into compatibility issues. I really like NetBeans and choose it over other IDEs. I just understood it without reading too much documentation. I'm also able to take code running in a production environment and move it into netbeans for editing very quickly. The integration of different J2ee application servers allows me to test what i modified.

Saturday, January 26, 2008

Shoot 'Em Up

Today i tried to watch "Shoot 'Em Up" with Nero Showtime 4 and it didn't work. But i tried it on my stand-alone DVD player and it worked ok. Nero Showtime 4 shows a popup that states:
"Playback is impossible because CSS copy protection failed." I guess this DVD is using a CSS copy protection that is different from others.