juddiv3 部署到自己的tomcat中
How to install jUDDI on Tomcat by yourself1 Vote
Hi!
This week I had to install Apache jUDDI for the purpose of the “Knowledge Organization and WEB 3.0” class which is one of my Master’s degree disciplines at PPGI-UFRJ.
When I went to jUDDI‘s web site I discovered thatjUDDI have a embeded Apache Tomcat within it. No problem if I hadn’t already installed Tomcat.
Since I wouldn’t like to have 2 running Tomcat installations I decided to install and deployjUDDI in my existing Tomcatinstallation. After a few searches in Google I could not find someone who have already done it. That’s why I decided to write this (not so comprehensive) instructions.
Well, since I have already had a running Tomcatinstallation you will have to install it. It’s very easy. You can find alot of HOW TOs around. Therefore, I consider the following prerequisites for my step-by-step installation instructions of jUDDI.
Prerequisites:
[*]Java Platform, Standard Edition (Java SE). I have jdk1.6.0_21;
[*]Apache Tomcat. I have apache-tomcat-6.0.29 running on port 8080;
Having properly installed and configured Java and Tomcat we can now start with the other jUDDI‘s prerequisites.
Step 1 – Install MySQL and create a database for jUDDI
[*]Download and install MySQL Community Server 5.5.14. Choose the MSI installer version;
[*]Now let’s create a user and a database for jUDDI…
[*]Execute the MySQL Command Line Client (It’s in Windows’ Program menu);
[*]Execute these 3 commands: “CREATE USER ‘juddi’@'localhost’ IDENTIFIED BY ‘juddi’;“, “CREATE DATABASE juddi;” and “GRANT ALL PRIVILEGES ON juddi.* TO ‘juddi’@'localhost’;“;
Step 2 – Deploy Apache jUDDI
[*]Download jUDDI portal bundle 3.0.4 and unzip it. Although this zip have an embeded Tomcat installation we won’t use it. We’ll need jus some webapps inside it.
[*]Copy the juddiv3, pluto and juddi-portlets folders (they are located inside the webapps folder in the zip file) to Tomcat‘s webapps folder. Again, just as a reference my webapps folder is in C:\Program Files\apache-tomcat-6.0.29\webapps;
[*]Also copy the following libraries from your zip’s juddi-portal-bundle-3.0.4\lib folder to your existing C:\Program Files\apache-tomcat-6.0.29\webapps folder:
[*]castor-1.1.1.jar
[*]commons-discovery-0.2.jar
[*]commons-logging-1.1.jar
[*]pluto-container-1.1.7.jar
[*]pluto-descriptor-api-1.1.7.jar
[*]pluto-descriptor-impl-1.1.7.jar
[*]pluto-taglib-1.1.7.jar
[*]portlet-api-1.0.jar
[*]log4j-1.2.13.jar
Step 3 – Configure MySQL JNDI Resources in Tomcat
[*]Download MySQL Connector/J 5.1.17 (the official JDBC driver for MySQL) and unzip it. Find the mysql-connector-java-5.1.17-bin.jar file and copy it to the lib folder of your existing Tomcat installation. My Tomcat‘s lib is in C:\Program Files\apache-tomcat-6.0.29\lib;
[*]Open the file C:\Program Files\apache-tomcat-6.0.29\webapps\juddiv3\META-INF\context.xml with any text editor and edit it in order to look like this…
[*]
[*]<?xml version=”1.0″ encoding=”UTF-8″?>
[*]<Context>
[*]<WatchedResource>WEB-INF/web.xml</WatchedResource>
[*] <Resource
[*] name=”jdbc/juddiDB“
[*] auth=”Container”
[*] type=”javax.sql.DataSource”
[*] username=”juddi”
[*] password=”juddi”
[*] driverClassName=”com.mysql.jdbc.Driver”
[*] url=”jdbc:mysql://localhost:3306/juddi”
[*] />
[*]</Context>
[*]Now a very important thing. There are 3 other files that must be in synch with the context.xml. The resource name juddiDB must be present in the following files relative to C:\Program Files\apache-tomcat-6.0.29\webapps\juddiv3\WEB-INF\:
[*].\web.xml: Set the value of <res-ref-name> as jdbc/juddiDB;
[*].\classes\juddiv3.properties: Set the property juddi.persistenceunit.name with value juddiDB;
[*].\classes\META-INF\persistence.xml: Set the persistence-unit‘ name to juddiDB, set <non-jta-data-source> value to java:comp/env/jdbc/juddiDB and make sure there is a <property name=”openjpa.jdbc.DBDictionary” value=”mysql“/> element in it.
Step 4 – Add users and roles to Tomcat
[*]Open C:\Arquivos de programas\apache-tomcat-6.0.32\conf\tomcat-users.xml and make sure it looks like this one:
<?xml version=’1.0′ encoding=’utf-8′?>
<tomcat-users>
<role rolename=”pluto“/>
<role rolename=”tomcat”/>
<role rolename=”manager”/>
<user username=”root” password=”root” roles=”pluto,tomcat,manager”/>
<user username=”uddi” password=”uddi” roles=”pluto,tomcat,manager”/>
<user username=”sales” password=”sales” roles=”pluto,tomcat,manager”/>
<user username=”marketing” password=”marketing” roles=”pluto,tomcat,manager”/>
<user username=”tomcat” password=”tomcat” roles=”manager”/>
</tomcat-users>
Step 5 – Enjoy your brand new Registry
Now start Tomcat and open your web browser at http://localhost:8080/juddiv3/. You should see a Apache jUDDI‘s welcome page like this one…
http://thoughtsasaservice.files.wordpress.com/2011/07/juddi-welcome-page.png?w=632&h=528The Apache jUDDI's welcome page
…or like the following one if you click on the jUDDI Portal link…
http://thoughtsasaservice.files.wordpress.com/2011/07/juddi-portal.png?w=632&h=261Pluto: The jUDDI portal
Now you may for example connect to juddi MySQL database and execute the command “show tables;” just to list all tables created by the jUDDI installation process.
Some very important notes:
[*]Of course the instructions on this post are not perfect for a production environment. I installed everything in my windows developmentsandbox. If you are installing it for a production environment I strongly recommend you not to use the same password as the login name ofthe MySQL user. Another thing is to change the default jUDDI Authentication.
[*]It’s possible to do the same thing for a Linux environment. Just follow the instructions having Linux on your mind;
I’ll talk more about Apache jUDDI Registry on a next post.
Stay away from trouble!
Update at 2011-07-23 23:17
After logging in at Pluto you probably will see that the portlets don’t work. It may print some strack trace errors inside the portlet windows or a javascript alert “erro:null” is shown. To solve this problem you’ll have to do the following:
Make sure the file juddiv3.properties of webapps/juddiv3 and webapps/uddi-portlets have the same configurations. Therefore, copy webapps/juddiv3/WEB-INF/classes/juddiv3.properties to webapps/uddi-portlets/WEB-INF/classes/juddiv3.properties.
页:
[1]