Home » Developer & Programmer » JDeveloper, Java & XML » ORA-29531: no method <string> in class <string>
ORA-29531: no method <string> in class <string> [message #411801] Mon, 06 July 2009 19:55 Go to next message
baekyasi
Messages: 4
Registered: July 2009
Location: Republic of Korea
Junior Member
Hi,
I am trying to use Java Stored procedure for the first time.
Help me, please.

-------------------------------------
Loading java Source (DB ver. 10g)
-------------------------------------
package util;

import java.io.IOException;
import sun.misc.BASE64Encoder;

import java.security.MessageDigest;
import java.security.Key;
import java.security.InvalidKeyException;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.Cipher;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.SecretKeyFactory;

public class UtilCryptoOuter {

private Key keyMulticampus = null;

private Cipher cipher = null;
private DESedeKeySpec kspec = null;
private SecretKeyFactory skf= null;
private String keyvalue = null;


public UtilCryptoOuter() {

try {
cipher = Cipher.getInstance("DESede");
skf= SecretKeyFactory.getInstance("DESede");
} catch (Exception e) {
System.out.println(e.toString());
}
}

//
public void setKey(String in) throws InvalidKeyException, InvalidKeySpecException{

keyvalue = in;

kspec = new DESedeKeySpec(keyvalue.getBytes());
keyMulticampus = skf.generateSecret(kspec);
}


//
public String encrypt3DES(String input)
throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException {

cipher.init(Cipher.ENCRYPT_MODE, keyMulticampus);
return ((new BASE64Encoder()).encode(cipher.doFinal(input.getBytes()))).replaceAll("\r\n","");
}

//
public String decrypt3DES(String input)
throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException, IOException {

byte[] encryptionBytes = new sun.misc.BASE64Decoder().decodeBuffer(input);
cipher.init(Cipher.DECRYPT_MODE, keyMulticampus);
return new String(cipher.doFinal(encryptionBytes));
}

// TEST
public static void main(String args[]) throws Exception {
String strResult = null;
UtilCryptoOuter uco = new UtilCryptoOuter();

if (args[0].equals("Enc")) {
System.out.println("Encode : " + uco.encrypt3DES(args[1]));
}
else {
System.out.println("Decode : " + uco.decrypt3DES(args[1]));
}
}

}


-------------------------------------
Loading java Source Result
-------------------------------------
select *
from user_objects where object_type LIKE 'JAVA%' ;

==>
util/UtilCryptoOuter JAVA SOURCE VALID
util/UtilCryptoOuter JAVA CLASS VALID


-------------------------------------
Created function
-------------------------------------
CREATE OR REPLACE PACKAGE BODY common_bl_pkg IS
.....
FUNCTION encrypt3DES(param1 VARCHAR2) RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'util.UtilCryptoOuter.encrypt3DES(java.lang.String) return java.lang.String';
.....
END common_bl_pkg;


-------------------------------------
Execute
-------------------------------------
SELECT common_bl_pkg.encrypt3DES('A')
FROM dual;

==>
ORA-29531: no method encrypt3DES in class util/UtilCryptoOuter
Re: ORA-29531: no method <string> in class <string> [message #411803 is a reply to message #411801] Mon, 06 July 2009 19:58 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
oerr ora 29531
29531, 00000, "no method %s in class %s"
// *Cause: An attempt was made to execute a non-existent method in a
//          Java class.
// *Action: Adjust the call or create the specified method.


http://asktom.oracle.com/pls/asktom/f?p=100:1:3397294881595542::NO:RP::

[Updated on: Mon, 06 July 2009 20:00]

Report message to a moderator

Re: ORA-29531: no method <string> in class <string> [message #411813 is a reply to message #411801] Mon, 06 July 2009 23:30 Go to previous message
baekyasi
Messages: 4
Registered: July 2009
Location: Republic of Korea
Junior Member
Thanks, BlackSwan.

But, decrypt3DES was located.
==> java Source Line 56
==> public String decrypt3DES(String input)

Can Anybody tell me why it happens??

-B.rgds
Previous Topic: Cannot run application adfm-new due to error deploying to DefaultServer.
Next Topic: Using JDev to easily modify XML Stylesheets (.xsl)
Goto Forum:
  


Current Time: Thu Mar 28 04:15:31 CDT 2024