You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by qcfireball <qc...@yahoo.com> on 2007/06/21 20:49:08 UTC
Quick RMI Howto for those in need
1 - install jackrabbit into your app container
note: you will get some errors in the appserver logfile. this is due to
the fact that the repository
is not yet setup.
2 - BEFORE you view the URL
"http://{your-hostname-here}:{your-port-here}/jackrabbit-webapp-1.3/"
edit the following file:
{your-appserver-path}/webapps/jackrabbit-webapp-1.3/WEB-INF/templates/bootstrap.properties
and make sure the following entries have the proper values:
rmi.port={your-rmi-port-here}
rmi.host={your-hostname-here}
repository.home={your/repository/location/here}
repository.name={your.repository.name.here}
some notes on these values:
---------------------------
a) using a port value of zero implies port 1099
b) for repository.home, it seems you can provide a relative path or an
absolute path. what happened to me was,
i used a value of "jackrabbit/repository". bacause i used tomcat, and the
start script runs out of the "bin"
directory, my repository is located in
"/opt/tomcat/bin/jackrabbit/repository"
3 - create the following file in the
{your-appserver-path}/webapps/jackrabbit-webapp-1.3/META-INF/context.xml
<Context path="/jackrabbit-webapp-1.3">
<Resource name="jcr/repository"
auth="Container"
type="javax.jcr.Repository"
factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
url="//{your-hostname-here}:{your-rmi-port-here}/{your.repository.name.here}"
/>
</Context>
i am not sure if this file is entirely required. it was mentioned in a post
somewhere. i used it because i
was having problems, and they seemed to go away after creating this file.
4 - navigate to the URL
http://{your-hostname-here}:{your-port-here}/jackrabbit-webapp-1.3/
this time you will see an "error" saying that your repository is not yet
created. The message is as follows:
Error while accessing the repository: The repository is not available.
Check the configuration or use the easy setup wizard.
keep in mind, that what you enter in the text box next to:
Repository Home:
must be reflected in the seetings discussed above. for example, i enetered
"jackrabbit", and it created the
directory i mentioned above.
click the "create" button.
your repository is now setup
5 - you can now connect to your repository. Make sure you have the
jackrabbit-jcr-rmi-1.3.jar AND
jcr-1.0.jar
in your classpath. code to connect is something like this:
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.Workspace;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NodeTypeManager;
import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.apache.jackrabbit.rmi.client.ClientNodeTypeManager;
private static final void quickConnect() {
final String sServer = "kelleher-home";
final String sPort = "1099";
final String sRepo = "jackrabbit.repository";
final String sUrl = "//" + sServer + ":" + sPort + "/" +
sRepo;
final String sWorkspace = "default";
try {
final ClientRepositoryFactory factory = new
ClientRepositoryFactory();
final Repository r = factory.getRepository(sUrl);
final SimpleCredentials sc = new
SimpleCredentials("anonymous", "".toCharArray());
final Session sess = r.login(sc, sWorkspace);
final Workspace wksp = sess.getWorkspace();
final NodeTypeManager ntm = wksp.getNodeTypeManager();
final ClientNodeTypeManager cntm = (ClientNodeTypeManager) ntm;
log("Everything executed without error.");
} catch (Exception ex) {
ex.printStackTrace();
}
}
I have not, as of yet, been able to get things working thru a firewall. For
example, I wanted to connect to my repository at home. This involved going
thru our proxy server at work (which doesn't seem to be a problem, maybe),
and thru my firewall at home. I am using port forwarding at home.
--
View this message in context: http://www.nabble.com/Quick-RMI-Howto-for-those-in-need-tf3960611.html#a11239251
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
Re: Quick RMI Howto for those in need
Posted by qcfireball <qc...@yahoo.com>.
ALSO: refer to this piost for a gotcha:
http://www.nabble.com/jcr-rmi-problems-tf3928960.html#a11143397
qcfireball wrote:
>
> 1 - install jackrabbit into your app container
> note: you will get some errors in the appserver logfile. this is due to
> the fact that the repository
> is not yet setup.
>
> 2 - BEFORE you view the URL
> "http://{your-hostname-here}:{your-port-here}/jackrabbit-webapp-1.3/"
> edit the following file:
> {your-appserver-path}/webapps/jackrabbit-webapp-1.3/WEB-INF/templates/bootstrap.properties
> and make sure the following entries have the proper values:
>
> rmi.port={your-rmi-port-here}
> rmi.host={your-hostname-here}
> repository.home={your/repository/location/here}
> repository.name={your.repository.name.here}
>
> some notes on these values:
> ---------------------------
> a) using a port value of zero implies port 1099
> b) for repository.home, it seems you can provide a relative path or an
> absolute path. what happened to me was,
> i used a value of "jackrabbit/repository". bacause i used tomcat, and the
> start script runs out of the "bin"
> directory, my repository is located in
> "/opt/tomcat/bin/jackrabbit/repository"
>
>
> 3 - create the following file in the
> {your-appserver-path}/webapps/jackrabbit-webapp-1.3/META-INF/context.xml
>
> <Context path="/jackrabbit-webapp-1.3">
> <Resource name="jcr/repository"
> auth="Container"
> type="javax.jcr.Repository"
>
> factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
>
> url="//{your-hostname-here}:{your-rmi-port-here}/{your.repository.name.here}"
> />
> </Context>
>
> i am not sure if this file is entirely required. it was mentioned in a
> post somewhere. i used it because i
> was having problems, and they seemed to go away after creating this file.
>
>
> 4 - navigate to the URL
> http://{your-hostname-here}:{your-port-here}/jackrabbit-webapp-1.3/
> this time you will see an "error" saying that your repository is not yet
> created. The message is as follows:
>
> Error while accessing the repository: The repository is not available.
> Check the configuration or use the easy setup wizard.
>
>
>
> keep in mind, that what you enter in the text box next to:
>
> Repository Home:
>
> must be reflected in the seetings discussed above. for example, i
> enetered "jackrabbit", and it created the
> directory i mentioned above.
>
> click the "create" button.
>
> your repository is now setup
>
> 5 - you can now connect to your repository. Make sure you have the
> jackrabbit-jcr-rmi-1.3.jar AND
> jcr-1.0.jar
> in your classpath. code to connect is something like this:
>
>
> import javax.jcr.Node;
> import javax.jcr.Property;
> import javax.jcr.Workspace;
> import javax.jcr.nodetype.NodeType;
> import javax.jcr.nodetype.NodeTypeManager;
> import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory;
> import javax.jcr.Repository;
> import javax.jcr.Session;
> import javax.jcr.SimpleCredentials;
> import org.apache.jackrabbit.rmi.client.ClientNodeTypeManager;
>
>
> private static final void quickConnect() {
> final String sServer = "kelleher-home";
> final String sPort = "1099";
> final String sRepo = "jackrabbit.repository";
> final String sUrl = "//" + sServer + ":" + sPort + "/" +
> sRepo;
> final String sWorkspace = "default";
>
> try {
> final ClientRepositoryFactory factory = new
> ClientRepositoryFactory();
> final Repository r = factory.getRepository(sUrl);
>
> final SimpleCredentials sc = new
> SimpleCredentials("anonymous", "".toCharArray());
> final Session sess = r.login(sc, sWorkspace);
> final Workspace wksp = sess.getWorkspace();
> final NodeTypeManager ntm = wksp.getNodeTypeManager();
> final ClientNodeTypeManager cntm = (ClientNodeTypeManager)
> ntm;
> log("Everything executed without error.");
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> I have not, as of yet, been able to get things working thru a firewall.
> For example, I wanted to connect to my repository at home. This involved
> going thru our proxy server at work (which doesn't seem to be a problem,
> maybe), and thru my firewall at home. I am using port forwarding at home.
>
--
View this message in context: http://www.nabble.com/Quick-RMI-Howto-for-those-in-need-tf3960611.html#a11239282
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.