Wednesday, April 30, 2008

Accessing a HostGator SVN repository via SVN+SSH on Windows

This information should be helpful to anyone trying to access an svn repository stored on a remote (shared) server which does not expose an svn server.

My host is HostGator (good speeds, reliable ssh, cgi-only, MyISAM-only, decent support, non-existent knowledgebase). HostGator runs SSH over port 2222 which presents a few problems when trying to use traditional methods to connect to an SVN repository via SSH.

For these steps you will need Putty. Just get the whole suite.

  1. Generate an RSA key using PuttyGen
  2. Copy the public key into your ~/.ssh/authorized_keys file on the server.
  3. Prepend your key with (so it's all on one line):
    command="/usr/bin/svnserve -t"

    This sets up svnserve to run in tunnel mode. The ramification of this is that you can no longer use this RSA key to auto-login on the shell. There is some information out there about creating an svn.mydomain.com subdomain and only having this rule apply to that subdomain, which solves that problem. On *nix machines this involves adding a simple rule to your SSH keystore that says "use key X when connecting to svn.mydomain.com and key Y when connecting to mydomain.com". Then you would have two entries in your authorized_keys file, one with the svnserve command for connections to svn.mydomain.com using key X and one without for key Y.

  4. Now load your private key into Pageant
  5. Create a new Putty connection called mydomain.com.

    • Set the the Auto-login username.
    • Ensure that SSH->Auth->Attempt authentication using Pageant is checked.
    • Create an SSH tunnel which forwards LOCAL port 22 to mydomain.com port 2222.

    SAVE the connection and then test it by opening it. You should be logged in without having to provide a password.

    SVN should now be working when you use TortoiseSVN (or a similar client I assume). However, svn from the command line will not work and will report "Can't create tunnel..."

    Now to get SVN working from the command line.

  6. Create an SVN_SSH environment variable with value (keep the quotes and use forward slashes):
    "C:/Program Files/PuTTY/plink.exe"

    SVN will now use plink to try to connect to the svn repository. This will only work if the domain of your svn root's URL is named the same as the Putty connection you created i.e. mydomain.com.

If you find that you are getting errors when running "svn info" on a URL I found that version 1.4.2 works for Windows but 1.4.6 does not.

Friday, April 25, 2008

Oracle 10g timezones and setting the Java timezone

To see your session and database timezones:
SELECT sessiontimezone, dbtimezone FROM dual;
To set them:
ALTER database SET TIME_ZONE = '-07:00';
ALTER session SET TIME_ZONE = '-07:00';
Alternatively you can set it by supplying a region which exists in the following list:
SELECT tzname, tzabbrev FROM V$TIMEZONE_NAMES;
To set the JVM timezone append the following option when calling java:
-Duser.timezone=Asia/Japan
Java stores the supported timezones in files located at:
c:\path\to\jdk1.5.0_12\jre\lib\zi\
To set the timezone within your code, which is sometimes neccessary because OC4J seems to ignore my -Duser.timezone option:
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("America/Vancouver");
java.util.TimeZone.setDefault(tz);

Here is a JSP page to display some time and timezone related information:

<%@ page language=\"java\" contentType=\"text/html; charset=ISO-8859-1\"
    pageEncoding=\"ISO-8859-1\"%>
<%@ page import=\"
  java.util.*,
  java.text.DateFormat\" %>
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
<title>TimeZone Test</title>
</head>
<body>
Your current timezone is: <%= java.util.TimeZone.getDefault().toString() %>
<p>
The current time is: <%= (new java.util.Date()).toString() %>
<p>
The value of the user.timezone property is: <%= System.getProperty(\"user.timezone\") %>
<p>
The date using DateFormat is: <%= DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(new Date()) %>
</body>
</html>

Wednesday, April 16, 2008

oc4j 10.1.3.2.0 is missing a required rmi class PropagatedIdentity

Today I was getting an error on the console which I have included below. The error prevents the BPEL server from calling our application server via rmi, which results in some BPEL processes not being executed.

Oc4j10.1.3.2.0 is missing the oracle.oc4j.rmi.interceptors.PropagatedIdentity class which should be in C:/appservers/oc4j10.1.3.2.0/j2ee/home/lib/oc4j-internal.jar.

The required class was found in C:\appservers\famsbpel1013\j2ee\home\oc4jclient.jar. I copied the oracle.oc4j.rmi.interceptors class folder from oc4jclient.jar to oc4j-internal.jar and everything worked fine with no errors.

If everything is running 10.1.3.3.0 you should be ok.

Here's the error:

08/04/16 18:24:20 SEVERE: RMIInterceptorManagerImpl.readInterceptorContexts unable to recover remote context:

         Missing class: oracle.oc4j.rmi.interceptors.PropagatedIdentity
       Dependent class: com.evermind.io.ClassLoaderObjectInputStream
                Loader: oc4j:10.1.3
           Code-Source: /C:/appservers/oc4j10.1.3.2.0/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in C:\appservers\oc4j10.1.3.2.0\j2ee\home\oc4j.jar

This load was initiated at fams.root:0.0.0 using the Class.forName() method.

The missing class is not available from any code-source or loader in the system.

08/04/16 18:24:20 SEVERE: RMIInterceptorManagerImpl.readInterceptorContexts unable to recover remote context:

         Missing class: oracle.oc4j.rmi.interceptors.PropagatedIdentity
       Dependent class: com.evermind.io.ClassLoaderObjectInputStream
                Loader: oc4j:10.1.3
           Code-Source: /C:/appservers/oc4j10.1.3.2.0/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in C:\appservers\oc4j10.1.3.2.0\j2ee\home\oc4j.jar

This load was initiated at fams.root:0.0.0 using the Class.forName() method.

The missing class is not available from any code-source or loader in the system.

08/04/16 18:24:20 SEVERE: RMIInterceptorManagerImpl.readInterceptorContexts unable to recover remote context:

         Missing class: oracle.oc4j.rmi.interceptors.PropagatedIdentity
       Dependent class: com.evermind.io.ClassLoaderObjectInputStream
                Loader: oc4j:10.1.3
           Code-Source: /C:/appservers/oc4j10.1.3.2.0/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in C:\appservers\oc4j10.1.3.2.0\j2ee\home\oc4j.jar

This load was initiated at fams.root:0.0.0 using the Class.forName() method.