Pras Tiwari

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

Recent posts by Pras Tiwari

Hi All
I have customized/patched java.util.CurrencyData class to add new currency in it. This new java.util.CurrencyData class works fine in my standsalone java program for new added currency. However when I try to load this added java 6 currency class into my Websphere Portal server 6.1 instance which is runinng on top of Java 6, it is unable to recognise this newly added currency class into its "Boot Classpath" settings.
Below are the steps I am following -
1) I have added this new java.util.CurrencyData class into a new jar (extendedCurrency.jar) and placed this new jar into ${WPS_HOME}/base/extdir/extendedCurrency.jar
2) Start Websphere portal server and go to Servers > Application Servers > server_name > Process Definition > Java Virtual Machine > Boot classpath and enter ${WPS_HOME}/base/extdir/extendedCurrency.jar in textbox.
3) Also go to Servers > Application Servers > server_name > Process Definition > Java Virtual Machine > Generic JVM Arguments and then add -Xbootclasspath/p:${WPS_HOME}/base/extdir/extendedCurrency.jar in it.
4) save settings and restart server
After these steps also my deployed web application is not picking up the updated java.util.CurrencyData class file. Is there any restriction on what type of jars/path can be added added to Boot classpath for Websphere Server?
On below page on IBM website its mentioned that " This option is only available for JVM instructions that support bootstrap classes and resources."
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.nd.doc%2Finfo%2Fae%2Fae%2Furun_rconfproc_jvm.html
What does this mean - " This option is only available for JVM instructions that support bootstrap classes and resources."??
Any help in this regard is much appreciated!!!

Regards,
Pras
10 years ago
Hi,

Can you try with -



Also check for IP address of Db service its mapping present in /etc/hosts file (On Windows machine eg. - C:/Program Files/System32/Drivers/etc/hosts)

--Pras
You can have look at basic start point by using jstl ftm:setlocale tag. The mini tutorial for same is at - http://www.tutorialspoint.com/jsp/jstl_format_setlocale_tag.htm

--Pras
11 years ago
JSP
Got one utility that reads bytes from .class file and interpret it:-

try {
String filename = "C:\\pal\\WTP_Workspace\\JavaSocketBridge\\src\\Test.class";
DataInputStream in = new DataInputStream(new FileInputStream(
filename));
int magic = in.readInt();
if (magic != 0xcafebabe) {
System.out.println(filename + " is not a valid class!");
}
int minor = in.readUnsignedShort();
int major = in.readUnsignedShort();
System.out.println(filename + ": " + major + " . " + minor);
in.close();
} catch (IOException e) {
System.out.println("Exception: " + e.getMessage());
}


Here the combination of major and minor version will reveal the java version against which class has been compiled.

Possible major/minor value are :
45.3=1.0
45.3=1.1
46.0=1.2
47.0=1.3
48.0=1.4
49.0=1.5
50.0=1.6

-----Pras----
12 years ago
Do I need to create self signed jar of all my files supporting applet and need to add entry for tools.jar inside META_INF/MANIFEST.MF ?
12 years ago
Hi,

I have written an applet program. It has some references to classes from java tools.jar in it (eg:- import com.sun.jdi.connect.IllegalConnectorArgumentsException)

When I run this applet through appletviewer utility it works fine. But when I embed this applet in HTML file and try to run it through web browser, I am getting exception about some classes not found at runtime:-

Java Plug-in 1.6.0_18
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Pras
----------------------------------------------------

java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jdi.connect.IllegalConnectorArgumentsException
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Caused by: java.io.FileNotFoundException: C:\pal\WTP_Workspace\JavaSocketBridge\bin\com\sun\jdi\connect\IllegalConnectorArgumentsException.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 17 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException

However the IllegalConnectorArgumentsException class is part of java runtime located inside tools.jar.

How I can get run it inside browser as well?

many thanks in advance.

Regards,
Pras
12 years ago
Any idea about this? Anybody?

Regards,
Pras
12 years ago
I am using eclipse IDE to tun this application:-

I am passing argument "com.sun.tools.example.trace.Client" as "Program Arguments" in "Arguments" tab of "Run Configuration". Then with this Run Configuration I run "Trace.java" as java program.

My java project structure in eclipse is:-

jdb --> Java project Name
--src --> Source Directory
--com.sun.tools.example.trace
--Trace.java
--Client.java

And output directory for this project is:- jdb/bin


12 years ago
I am trying to run Trace.java program that comes as a sample as part of Java Debugger Interface. This program provides command line trace of any input java program to it. It expects the name of java program to be traced as parameter.
This Trace.java is located in package "com.sun.tools.example.trace". The online location of Trace.java is at :- http://www.docjar.com/html/api/com/sun/tools/example/trace/Trace.java.html

And I pass another class to be traced as argument to this program called as Client.java which is located at package "com.sun.tools.example.trace". Both Trace.java and Client.java are part of same java project. Now when I try to run Trace.java using argument "com.sun.tools.example.trace.Client" I get below exception in my console:-

java.lang.NoClassDefFoundError: com/sun/tools/example/trace/Client
Caused by: java.lang.ClassNotFoundException: com.sun.tools.example.trace.Client
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.sun.tools.example.trace.Client. Program will exit.
Exception in thread "main" -- VM Started --
-- The application exited --


Any idea why I am getting this error though Client.java is present at correct path as provided in argument to Trace.java?

Many thanks in advance.

-Pras
12 years ago
Thanks for reply.

But any iodea about this?

- as the parent class (Object) is having method toString which has return type of Child class (String). How it has been at the time of initial writing of Object Class?

public String toString() {
......
}

How dependency got resolved at the initial time while writing Object class? As both class has reference to each other.?


Regards,
Pras
13 years ago
Hi Seetharaman,

My query is as the parent class (Object) is having method toString which has return type of Child class (String). How it has been at the time of initial writing of Object Class?

public String toString() {
......
}

How dependency got resolved at the initial time while writing Object class? As both class has reference to each other.?

Also as Object is parent class of String in String Definition fron Java Souce code

public final class String implements java.io.Serializable, Comparable, CharSequence{
....
}

there is no "extends Object" there? Why so?

Regards,
Prashant
13 years ago
Just came this question into my mind.

As Object is superclass of all classes in Java, so is the superclass of String class.

But Object Class has toString method in it which has return type of "String" (its child class). And String is the class with Object as parent class. So how this circular dependeny got managed at the time of creating initial version of Java by Java creators. How the compiled Object class against its dependency with its child class?

Did they removed the toString method initially to compile Objecl class successfully and then after compilation of String class against properly compiled Object class they added toString method to Object class back and compiled Object class again with compiled String class?

This question just came out of curiocity in my mind. May be stupid question/answer would be stupid.??

Regards,
Pras
13 years ago
Thanks a lot Martijn for your support....
Will check on the forum if I get something there..
Hi Martijn

As per your suggession I tried to add listener as follows:-

output.getState().waitForState(IOStreamConnectorState.CLOSED);

But thread never crossing this line, as this state seems to be never reached.

Do you have any other method for this?

Many thanks again for your help & suggessions.

--Pras
Hi William

Thanks for your reply...I gone through document

So for ESC key, is the below statement correct?

session.getOutputStream().write(("\X1B").getBytes());

or

session.getOutputStream().write(("\e").getBytes());


Also how about sending combination of 2 characters? say "CTRL + C" ?

Please provide your input on this.

Many thanks again.
14 years ago