Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exception stacktrace with JDK1.4

0 views
Skip to first unread message

fabien Saya

unread,
May 7, 2002, 5:04:07 AM5/7/02
to
Hi everybody,

I'm using the new jdk1.4 under linux and its nio features to write a non
blocking socket server.
My problem is it doesn't give me the line where the error occurs and I can't
find the parameter to set
to get them as I got them with jdk1.3.
It does the same on solaris (but when I'm using JBuilder under windows to
run the server, then it shows me the
line of the error).

Here are more information :

Inside the code, when I get an exception, I log the stacktrace in a file and
get the stacktrace string
using the following method :

static public String getStackTrace(Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
return sw.toString();
}

/*******************
My command line to run the jvm is as follow:

CLASSPATH=$CLASSPATH:/home/java/NBBus/DEV/jar/personnal.jar
CLASSPATH=$CLASSPATH:/home/java/NBBus/DEV/

nohup
/usr/java/j2sdk1.4.0/bin/java -Djava.compiler=NONE -Djava.vm.version="1.2" -
cp $CLASSPATH -Djava.security
.policy=/home/java/NBBus/DEV/properties/java.policy nbbus.Server &
/*******************

When I get an exception, here is a stacktrace example:

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.net.Socket.connect(Socket.java:425)
at java.net.Socket.connect(Socket.java:375)
at java.net.Socket.<init>(Socket.java:290)
at java.net.Socket.<init>(Socket.java:146)
at
com.personnal.util.TimedSocket$SocketThread.run(TimedSocket.java:158)
at nbbus.communication.ServeurComSocketToSwitch.connect(Unknown
Source)
at nbbus.thread.ThreadReqSwitch.run(Unknown Source)

In the stacktrace, I've got the error line of all the object (even my
personnal jar) but not the one from my server (the one that interest me),
I got instead (Unknown Source).
I can't find where I'm wrong. The -Djava.compiler=NONE seems to be useless
as I got the same problem with or without it.
In my classpath, I put :/home/java/NBBus/DEV/ which is the folder where my
package
nbbus is stored (There are all the .java and .class file in that folder) :

[java@srv-icsat3 nbbus]$ pwd
/home/java/NBBus/DEV/nbbus
[java@srv-icsat3 nbbus]$ ls -lisa
total 76
30887 4 drwxr-xr-x 9 java java 4096 May 7 10:02 .
55944 4 drwxr-xr-x 7 java java 4096 May 7 10:01 ..
30892 4 drwxr-xr-x 3 java java 4096 May 6 15:18
bddaccess
30907 4 -rw-rw-r-- 1 java java 1222 May 6 15:18
ChannelCallback.class
30888 4 -rw-r--r-- 1 java java 1328 May 6 15:17
ChannelCallback.java
55945 4 drwxr-xr-x 3 java java 4096 May 6 15:18
communication
55964 4 drwxr-xr-x 2 java java 4096 May 6 15:17 CVS
30899 4 drwxr-xr-x 3 java java 4096 May 6 15:18
exception
30908 16 -rw-rw-r-- 1 java java 13716 May 6 15:18
Server.class
30889 16 -rw-r--r-- 1 java java 16362 May 6 15:17
Server.java
17615 4 drwxr-xr-x 3 java java 4096 May 6 15:18
structure
17618 4 drwxr-xr-x 3 java java 4096 May 6 15:18 thread
55973 4 drwxr-xr-x 3 java java 4096 May 6 15:18 util

note that using the same method under jdk1.3 or jdk1.2.2 works fine. I've
tried to find the
solution in java docs about jdk1.4 but I get lost in them. Does anyone know
where I could find the answer?

Thanks
Fabien Saya


Geoff Rimmer

unread,
May 7, 2002, 9:11:06 AM5/7/02
to
"fabien Saya" <fs...@travelprice.com> writes:
>
> When I get an exception, here is a stacktrace example:
>
> java.net.ConnectException: Connection refused
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> [...]

> at com.personnal.util.TimedSocket$SocketThread.run(TimedSocket.java:158)
> at nbbus.communication.ServeurComSocketToSwitch.connect(Unknown Source)
> at nbbus.thread.ThreadReqSwitch.run(Unknown Source)

Do you compile your Java using the <javac> task in "ant"? If so, try
adding debug="on". For example, change:

<javac srcdir="src" destdir="classes" includes="**/*.java" />

to:

<javac debug="on" srcdir="src" destdir="classes" includes="**/*.java" />

Maybe this is another one for the FAQ?

--
Geoff Rimmer <> geoff....@sillyfish.com <> www.sillyfish.com
www.sillyfish.com/phone - Make savings on your BT and Telewest phone calls
UPDATED 14/04/2002: 508 destinations, 12 schemes (now with contact details)

fabien Saya

unread,
May 7, 2002, 9:36:34 AM5/7/02
to
Thanks a lot, it works great.

Fabien

"Geoff Rimmer" <geoff....@sillyfish.com> a écrit dans le message de news:
m34rhk6...@dave.local...

0 new messages