Victor Lee wrote:
> Interesting article: http://www.gnu.org/philosophy/java-trap.html

Interesting article:
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise


>  Why can't nutch be compiled in GCJ?  

Closer inspection of your error files indicates the class not compiling are

 DummySSLProtocolSocketFactory.java

and

 DummyX509TrustManager.java

from the protocol-httpclient plugin. It's not compiling because
DummySSLProtocolSocketFactory uses/imports:

  import com.sun.net.ssl.SSLContext;
  import com.sun.net.ssl.TrustManager;

and DummyX509TrustManager uses/imports:

  import com.sun.net.ssl.TrustManagerFactory;
  import com.sun.net.ssl.TrustManager;
  import com.sun.net.ssl.X509TrustManager;

> Does it use some Sun libraries that GCJ doesn't have?

I guess so. here are some options.

Perhaps GJC has an alternative SSL stack you can compile against.


If you are not using the protocol-httpclient plugin you could try
removing the calls to its ant tasks from:

 nutch\trunk\src\plugin\build.xml

and deploy without it.

If you're feeling adventurous you could patch protocol-httpclient to use
the javax.net.ssl classes and submit it to JIRA - use of com.sun.net.ssl
is deprecated (I think). The imports can be replaced directly with
java.net.ssl classes and there's two methods DummyX509TrustManager
doesn't implement from javax.net.ssl which can be  delegated to the
standardTrustManager. I've attached a manually edited patch file that
makes it clear what to do (my copy of protocolhttp-client is patched
already to handle basic-auth). I don't use GJC, but can confirm it built
with those mods on a Sun 1.4 JDK.

cheers
Bill
Index: 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummySSLProtocolSocketFactory.java
===================================================================
--- 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummySSLProtocolSocketFactory.java
     (revision 332354)
+++ 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummySSLProtocolSocketFactory.java
     (working copy)
@@ -22,8 +22,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import com.sun.net.ssl.SSLContext;
-import com.sun.net.ssl.TrustManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
 
 public class DummySSLProtocolSocketFactory implements ProtocolSocketFactory {
 
Index: 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java
===================================================================
--- 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java
     (revision 332354)
+++ 
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java
     (working copy)
@@ -10,14 +10,16 @@
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 
-import com.sun.net.ssl.TrustManagerFactory;
-import com.sun.net.ssl.TrustManager;
-import com.sun.net.ssl.X509TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
 import org.apache.commons.logging.Log; 
 import org.apache.commons.logging.LogFactory;
 
 public class DummyX509TrustManager implements X509TrustManager
 {
+
+
     private X509TrustManager standardTrustManager = null;
 
     /** Log object for this class. */
@@ -57,4 +59,19 @@
     public X509Certificate[] getAcceptedIssuers() {
         return this.standardTrustManager.getAcceptedIssuers();
     }
+
+
+  public void checkClientTrusted( X509Certificate[] x509Certificates, String s 
) throws CertificateException
+  {
+    //To change body of implemented methods use File | Settings | File 
Templates.
+    this.standardTrustManager.checkClientTrusted(x509Certificates, s);
+  }
+
+
+  public void checkServerTrusted( X509Certificate[] x509Certificates, String s 
) throws CertificateException
+  {
+    //To change body of implemented methods use File | Settings | File 
Templates.
+    this.standardTrustManager.checkClientTrusted(x509Certificates, s);
+  }
+
 }

Reply via email to