NOTE: PROCEDURE HTTP used (Total process time):
real time 8.63 seconds
cpu time 0.21 seconds
NOTE: PROCEDURE HTTP used (Total process time):
real time 0.15 seconds
cpu time 0.01 seconds
NOTE: The ADD CLASSPATH command completed.
NOTE: The ADD CLASSPATH command completed.
NOTE: The ADD CLASSPATH command completed.
java.lang.IllegalArgumentException: Failed to find sasjar commons_codec
1.7.0.0_SAS_20121211183158.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java
:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:516)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at
org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(Con
structorSite.java:84)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:200)
at Script9.findJar(Script9.groovy:2)
at Script9$findJar.callCurrent(Unknown Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:159)
at Script9.run(Script9.groovy:3)
ERROR: Failed to add sasjar commons_codec.
ERROR: The SUBMIT command failed.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script14592196615082045114769.groovy: 6: unable to resolve class
org.apache.commons.codec.binary.Base64
@ line 6, column 1.
import org.apache.commons.codec.binary.Base64
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:860)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:497)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:474)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:263)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:207)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:217)
ERROR: The SUBMIT command failed.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script10.groovy: 1: unable to resolve class DeenHash
@ line 1, column 7.
foo = new DeenHash()
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:860)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:497)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:474)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
at groovy.lang.GroovyShell.parse(GroovyShell.java:739)
at groovy.lang.GroovyShell.parse(GroovyShell.java:766)
at groovy.lang.GroovyShell.parse(GroovyShell.java:757)
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GROOVY used (Total process time):
real time 1.31 seconds
cpu time 0.00 seconds
NOTE: The data set WORK.FOO has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.00 seconds
WARNING: Could not initialize classpath. Classpath variable is not set.
ERROR: Could not find class DeenHash at line 925 column 17. Please ensure that the CLASSPATH
is correct.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
java.lang.ClassNotFoundException: DeenHash
at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:77)
at java.net.URLClassLoader.findClass(URLClassLoader.java:385)
at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:674)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:773)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.FOO.
NOTE: DATA statement used (Total process time):
real time 0.27 seconds
cpu time 0.00 seconds
/*****Here is the code which I used for above log file***********/ filename groovy '$DATA/deen_temp.html';
proc http method='get'
url="http://central.maven.org/maven2/org/codehaus/groovy/groovy-all/2.4.6/groovy-all-2.4.6.jar"
out=groovy;
run;
filename xmlbind '$DATA/deen_xml.html';
proc http method='get'
url="http://central.maven.org/maven2/javax/xml/bind/jaxb-api/2.2.12/jaxb-api-2.2.12.jar"
out=xmlbind;
run;
filename cp '$DATA/deen_hash.txt';
options set=classpath= "%sysfunc(pathname(cp,f))";
proc groovy classpath=cp;
add classpath=groovy;
add classpath=xmlbind;
add sasjar="commons_codec" version="1.7.0.0_SAS_20121211183158"; *version is specific to SAS Installation and may differ from this;
submit parseonly;
import javax.xml.bind.DatatypeConverter
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
import java.util.ArrayList
import org.apache.commons.codec.binary.Base64
/**
* DeenHash Requirements
*
*
* 1. Hash an input String (ex. "abc123") using SHA-256 algorithm
* 2. Concatenate input string + hexDump of step1 result
* 3. Hash step2 result using SHA-256 algorithm
* a. this marks a single-round
* b. print raw step3 result in Base64 encoding
* 4. Hash step3 result 999 additional times using SHA-256 algorithm
*/
public class DeenHash {
private String input = "abc123";
private String algorithm = "SHA-256";
protected ArrayList<byte[]> results=new ArrayList();
public DeenHash() {}
public DeenHash(String input) {
setInput(input);
}
public DeenHash(String algorithm, String input) throws NoSuchAlgorithmException{
setAlgorithm(algorithm);
}
public String getInput() {
return this.input;
}
public void setInput(String input) {
this.input = input;
}
public String getAlgorithm() {
return this.algorithm;
}
public void setAlgorithm(String algorithm) throws NoSuchAlgorithmException {
MessageDigest.getInstance(algorithm);
this.algorithm = algorithm;
}
private String toHexString(byte[] bytes) {
return DatatypeConverter.printHexBinary(bytes);
}
private String toBase64(byte[] bytes) {
Base64 base64 = new Base64();
return new String(base64.encode(bytes));
}
private byte[] merryGoRound(byte[] bytes) throws NoSuchAlgorithmException {
byte[] step4 = bytes;
for (int i=0; i<999; i++) { step4 = doSingleHash(step4); }
return step4;
}
public byte[] doSingleHash(byte[] bytes) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(this.algorithm);
md.update(bytes);
return md.digest();
}
public void doDeenHash() throws NoSuchAlgorithmException {
byte[] step1 = doSingleHash(this.input.getBytes());
String step2 = this.input + toHexString(step1).toLowerCase();
byte[] step3 = doSingleHash(step2.getBytes());
this.results.add(step3);
byte[] step4 = merryGoRound(step3);
this.results.add(step4);
}
public String getFinalHash() {
return toBase64(this.results.get(1));
}
public String getInitialHash() {
return toBase64(this.results.get(0));
}
public void main(String[] args) {
if (args.length == 1) {
setInput(args[0]);
} else if (args.length == 2) {
try {
setAlgorithm(args[0]);
setInput(args[1]);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
try {
doDeenHash();
System.out.println("Single Round: " + toBase64(this.results.get(0)));
System.out.println("Final Round: " + toBase64(this.results.get(1)));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
}
endsubmit;
submit;
foo = new DeenHash()
foo.main()
endsubmit;
quit;
data foo;
input foo $;
cards;
abc123
;
run;
data _null_;
dcl javaobj hash('DeenHash');
do until(done);
set foo end=done;
length one thousand $ 64;
hash.callVoidMethod('setInput',strip(foo)); *strip is important;
hash.callVoidMethod('doDeenHash');
hash.callStringMethod('getInitialHash',one);
hash.callStringMethod('getFinalHash',thousand);
put (one thousand) (=/);
end;
stop;
run;
... View more