exception in car and garage examples in user guide
Chinyi Woo <chinyi.woo <at> gmail.com>
2005-04-07 03:33:37 GMT
Hi,
I am a new comer. When I played ozone 1.2 on windonws according to the
user's guide, it threw exception as follows:
-------------------------------------------------------------------------------------------------------
H:\programming\ozone\samples\car>java MyApp create
Connected ...
H:\programming\ozone\samples\car>java MyApp print
Connected ...
The car gottfried is 48 years old.
Exception in thread "main" java.lang.NullPointerException
at org.ozoneDB.DxLib.net.DxClient.send(Unknown Source)
at org.ozoneDB.ExternalDatabase.close(Unknown Source)
at MyApp.main(MyApp.java:28)
-------------------------------------------------------------------------------------------------------
You can see that the car is succesfully created but exception happened
at print option. And I got similar output when I test Garage example:
-------------------------------------------------------------------------------------------------------
H:\programming\ozone\samples\car>java GarageApp create
Connected ...
H:\programming\ozone\samples\car>java GarageApp add firstcar 2004
Connected ...
carname: firstcar; year: 2004
Exception in thread "main" java.lang.NullPointerException
at org.ozoneDB.DxLib.net.DxClient.send(Unknown Source)
at org.ozoneDB.ExternalDatabase.close(Unknown Source)
at GarageApp.main(GarageApp.java:55)
-------------------------------------------------------------------------------------------------------
In the Garage, I can not even create car. I followed the instruction
exactly and everything during compilation works fine. I also attach a
snapshot on server side:
-------------------------------------------------------------------------------------------------------
Sever side:
(Ctrl-C or 'q' to shutdown without admin tool)
WARN [Thread-5] InvokeServer - handleClientException(): java.net.SocketExcepti
on: Connection reset
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Sourc
e)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.ozoneDB.DxLib.net.DxClient.receive(Unknown Source)
at org.ozoneDB.DxLib.net.DxMultiServerClient.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
-------------------------------------------------------------------------------------------------------
Another question is related to the transaction. In the user's guide,
it says every method outside server is a transaction. I test it by
putting System.exit(0) in the CarImpl.java as follows:
-------------------------------------------------------------------------------------------------------
public static void createCar() throws Exception {
// create a new Car object with the name "my_first_car"
// the return value is Car_proxy, which implements
the Car-interface
Car car = (Car)(db.createObject( CarImpl.class.getName(), 0,
"my_first_car" ));
System.out.println("exit");
System.exit(0);
car.setName( "gottfried" );
car.setYearOfConst( 1957 );
}
-------------------------------------------------------------------------------------------------------
I expected no car would have been created. However, when I run:
-------------------------------------------------------------------------------------------------------
H:\programming\ozone\samples\car>java MyApp create
Connected ...
exit
H:\programming\ozone\samples\car>java MyApp print
Connected ...
The car is 2005 years old.
Exception in thread "main" java.lang.NullPointerException
at org.ozoneDB.DxLib.net.DxClient.send(Unknown Source)
at org.ozoneDB.ExternalDatabase.close(Unknown Source)
at MyApp.main(MyApp.java:28)
-------------------------------------------------------------------------------------------------------
There is still a car created with default time. Now I am confused.
Could anyone help me on these two questions?
Thanks
Chinyi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click