John Peter

Greenhorn
+ Follow
since Jul 13, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John Peter

Dear all,

I have read the article about Authentication in MIDP (http://developers.sun.com/techtopics/mobility/midp/articles/security3/).
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
run:
[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 com.sun.midp.midlet.Selector.run(+22)
[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:
CertificateMidlet

Any guideline is really appreciated.
Thanks in advance.

Regards,
John
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 java.security.*;
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");
gen.initialize(KEY_SIZE);

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

try{
//obtain RSA Cipher

cipher =
Cipher.getInstance("RSA/ECB/PKCS1Padding","BC");
System.out.println(cipher.getProvider().getInfo());

}catch(Exception e){

System.out.println("err1"+e.toString());

}

//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.

Regards,
John Peter

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

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

if(fisherman_role!=null)
strSql+="where fisherman_condition...";

if(farmer_role!=null)
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.

Regards,
John
20 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.



Regards,
John

[added code tags - Jim]
[ April 07, 2005: Message edited by: Jim Yingst ]
20 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.

Rgds,
John
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.

Regards,
John
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.



Spider
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? :-|)