John Peter

+ Follow
since Jul 13, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Peter

Dear all,

I have read the article about Authentication in MIDP (
Hence, I try the application sample to get a feel of how authenticaton work.

But, I hit the error "ClassNotFoundException" in the client side, which I run ANT 1.6.4 to lauch the client application in J2ME Wireless Toolkit 2.2 and this error also being hitted if I use J2ME Wireless Toolkit 1.0.3

My test environment:
J2ME Wireless Toolkit 2.2
Apache Tomcat 5.0

Error in Command Prompt:
C:\WTK22\apps\MyProject\build>ant run
Buildfile: build.xml
[exec] Running with storage root DefaultColorPhone
[exec] Unable to create MIDlet CertificateMidlet
[exec] java.lang.ClassNotFoundException: CertificateMidlet
[exec] at com.sun.midp.midlet.MIDletState.createMIDlet(+14)
[exec] at
[exec] Execution completed.
[exec] 742368 bytecodes executed
[exec] 22 thread switches
[exec] 741 classes in the system (including system classes)
[exec] 3801 dynamic objects allocated (109584 bytes)
[exec] 1 garbage collections (0 bytes collected)

Error in Emulator:
After click launch button, the following error appeared:
Exception: java.lang.ClassNotFoundException:

Any guideline is really appreciated.
Thanks in advance.

19 years ago
Dear all,
I have implemented an RSA with BC provider using JCE as platform.
FYI,I am using j2sdk1.4.2_05 in Windows 98.

But I hits the following error:
class "org.bouncycastle.crypto.params.ParametersWithRandom 's signer
information does not match signer information of other classes in the same
package. Null pointer exception in "cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());"

The code is like follow:
import javax.crypto.*;
import org.bouncycastle.jce.provider.BouncyCastleProvider;

public class PublicCipher{

private static final int KEY_SIZE = 1024;

public static void main(String [] args) throws Exception{
byte [] plainText = "This is a session".getBytes("UTF8");

Security.addProvider(new BouncyCastleProvider());

KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");

KeyPair keyPair = gen.generateKeyPair();
System.out.println("RSA Key pair generated.");
Cipher cipher = null;

//obtain RSA Cipher

cipher =

}catch(Exception e){



//encrypt with public key.
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());
byte [] cipherText = cipher.doFinal(plainText);
System.out.println(new String(cipherText,"UTF8"));

//decrypt with private key
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPrivate());
byte [] newPlainText = cipher.doFinal(cipherText);
System.out.println(new String(newPlainText,"UTF8"));



Please help me.
Thanks in advance.

John Peter

19 years ago
Dear all,
I have see different results every time running the
benchmark program, it makes me hard to decided which is

The reason I concat string so many time is due to
the SQL is dynamic based on condition in my web application:
PreparedStatement ps = null;
ResultSet rs = null;
String strSql=null;
strSql="Select col1 from table1 ";

strSql+="where fisherman_condition...";

strSql+="where farmer_condition...";

if(farmer_role!=null && fisherman_role != null)
strSql+="where dual_condition...";
Hence, I said the sql will change differently based
on different conditions.

Any contructive idea is welcome.

19 years ago
Dear all,

Now, I am running the load test on 50000 users.

I want to compare the following for application performance tuning purpose:

1. String
Purpose: I will concatanate all the sql string for a db application.
2. StringBuffer with toString method
Purpose:I need to execute SQL statements in JDBC.If I append
all the sql string with StringBuffer, then I need to convert it to String
using toString() method.

A program has been written as follow: (to compare String/StringBuffer)
But I can't differenciate and decide which method is better.


[added code tags - Jim]
[ April 07, 2005: Message edited by: Jim Yingst ]
19 years ago
May I know how to shorter the transaction?
Reconstruct the logic, or ?

Please enlighten me in detail. E.g: Simple code to illustrate it.

Dear all,
My web application hits deadlock or timeout problems during select/insert/update/delete operation in the
database especially concurrent testing with 100 virtual users.

May I know how to avoid these two errors?

Could I said that these solutions will apply when the load volumn is 1000 users, 10000 users ...etc ?

All workable solutions are welcome.

Thanks. I 've use the http://localhost/manager/reload?path=my_web_app
to solve this. It is a good approach especially in the development phase.
To find more about it, we can refer the tomcat 4.0.1 documentation in the tomcat folder.

Everytime I modified the servlet source code and recompile it, I need to stop-start my Jakarta Tomcat 4.0.1, is there any alternative way which is easier and practical? :-|)