R: Servlet loading twice, Help me, please

2001-02-27 Thread Marco Isella

Hi had the same problem  i resolved with a static Object working as a lock
in the init method. 
The best thing however is to upgrade to 1.4.7 wich does not present this
strange behaviour anymore.

Marco

-Messaggio originale-
Da: Vinh Chu Xuan [mailto:[EMAIL PROTECTED]]
Inviato: luned, 26. febbraio 2001 17:06
A: Orion-Interest
Oggetto: Re: Servlet loading twice, Help me, please


Hi Phong,
I am now at home,so i do not have the source code here.
In this case you should use global Java Bean.
I will send you the sample.
Hope that will help you.
Talk to you later.
Best regards,
Vinh Chu Xuan
Vietnam Data Communication Company
Software RD Department
1E Truong Chinh - Hanoi - Vietnam
http://home.vnn.vn/vdc/index_e.html
Office : +84 4 8699112-307
Cell phone : +84 91 21 6116

- Original Message -
From: Phong Quoc Tran [EMAIL PROTECTED]
To: Orion-Interest [EMAIL PROTECTED]
Sent: Monday, February 26, 2001 8:37 AM
Subject: Servlet loading twice, Help me, please


Hi,

I have a servlet as a front component in my webapp; the servlet has also the
task of saving a Object in static variable (for example : a integer value )
during his inizialization.
When I start orion server, I set new value for static variable (for example
new value = 20 )
and I call the servlet  n  times ( n = 2 ) I see 2 servlet instance created
(see the output below)

Please help me, how to make only 1 servlet instance.

I have done a small example so that i can explain me in a more clear way :

my web.xml
  servlet
servlet-nameMyServlet/servlet-name
servlet-classMyServlet/servlet-class
load-on-startup0/load-on-startup
   /servlet

the code of the my object is
class  MyObject extends Object {
private static int myvar = 10;
public static void setVar(int var) {
myvar = var;
}
public void myprint() {
System.out.println("I'm a Object : " + this + " and my
variable : " + myvar);
}
}

the code of the servlet is:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class MyServlet extends HttpServlet {
public void init(ServletConfig conf) throws ServletException {
MyObject myObject = new MyObject();
myObject.myprint();
MyObject.setVar(20);
System.out.println("Done " + this);
}
public void service(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
doGet( request, response );
}
public void doGet(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
}
public void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
doGet( request, response );
}
}

now, if I start the server  i call the servlet n times (n = 2 ) i can see
2 servlet instance created (see the output below)
D:\webserver\Orionjava -jar orion.jar
I'm a Object : MyObject@7c1f2a88 and my variable : 10
Done MyServlet@66732a88
Orion/1.4.4 initialized
I'm a Object : MyObject@e86f2a8a and my variable : 10
Done MyServlet@c34f2a8a


I using Orion server 1.44,  and Please help me, how to make only 1 servlet
instance.
Thanks,
Phong Quoc Tran



===
Tran Quoc Phong

Paragon Solutions Vietnam (PSV)
26-28 Dong Du Street, District 1, HoChiMinh City, Vietnam
Phone  : (84-8) 8 251 250  (ext 181 or 182)
Office email  : [EMAIL PROTECTED]
Private email : [EMAIL PROTECTED]
Web site  : http://www.psv.com.vn






R: Problem with latest Oracle JDBC.zip..anyone having similar problems?

2001-02-26 Thread Marco Isella

Hi kevin, 
i dunno if it can help but i had a problem with oracle  streaming  it took
me 3 days before i could find what was going on.
The "Stream already closed" error appears when u are trying to read a stream
from the db  at the same time (with the same connection) u do other
operations on the db. Theoretically u should have had this problem also with
the earlier version of oracle's jdbc but if u didn't maybe it's just not
this the problem.
Anyway, that's wath in the spec:

The drivers automatically discard stream data if you perform any JDBC
operation that communicates with the database, other than reading the
current stream. 

Check
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.81
7/a83724/basic4.htm, maybe it can help you.

Marco

-Messaggio originale-
Da: Kevin Duffey [mailto:[EMAIL PROTECTED]]
Inviato: mercoledi, 31. gennaio 2001 21:25
A: Orion-Interest
Oggetto: Problem with latest Oracle JDBC.zip..anyone having similar
problems?


Hi there,

We just moved to Oracle 8.1.7 database (or upgraded to it). The new jdbc.zip
that is required to use it is causing some odd problems with Orion 1.3.8
that we are running. Specifically, it appears every time we try to connect
to the database it gives a "Stream already closed" error.

Is anyone experiencing similar problems? Will the 1.4.5 version of Orion fix
this? We tried removing the jdbc.jar in the orion folder, and we are only
using Orion for jsp/servlet engine (not yet done any EJB work).

Thanks.





R: Why is Netscape slower with Orion?

2001-02-09 Thread Marco Isella

One thing netscape is very very slow at is when it has to render nested
tables.. i had a page with 4 level nested tables  with netscape it was a
metter of second before the rendering was done; i switched to a single table
 the performing was almost acceptable (anyway far slower than ie).

This was wit ns 4.X, with ns 6 they have speed it up a little(but still much
slower than ie).
Marco


-Messaggio originale-
Da: Huibert Aalbers [mailto:[EMAIL PROTECTED]]
Inviato: venerdi, 26. gennaio 2001 17:58
A: Orion-Interest
Oggetto: Why is Netscape slower with Orion?


Hi everyone,

Is it just me or has anyone noticed that Netscape is significantly
slower than IE when accessing an application built with orion? Could
there be anything wrong with my settings?

Thanks,

Huibert Aalbers
Informix Software





Servlet loading twice if init() not finished?

2001-02-01 Thread Marco Isella

Hi,

i have a servlet as a front component in my webapp; the servlet has also the
task of loading objects from a db during his inizialization. Loading the
objects takes some time  i have encountered a situation wich i didn't
expected  wich i'm not sure if i'm doing something wrong or it is orion.
The situation is that if orion recive a request wich point to the servlet
before the servlet has finished the init() method (wich was triggered from a
previous request) it creates another instance of the servlet.

I have done a small example so that i can explain me in a more clear way :

in my web.xml file i have defined   mapped the servlet:
servlet
servlet-nametestServlet/servlet-name
servlet-classTestServlet/servlet-class
/servlet
servlet-mapping
servlet-nametestServlet/servlet-name
url-pattern/test/url-pattern
/servlet-mapping

the code of the servlet is:

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req, res);
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
System.out.println("doGet()");
}
public void init() {
System.out.println("init() " +this);
try {
Thread.currentThread().sleep(5000);// this is for simulating
the time consuming task
} catch (Exception e) {}
System.out.println("done! " + this);
}
}

now, if I start the server  i call the servlet 2 times (the second before
init() finish) i can see 2 servlet instance created (see the output below)

D:\orionjava -jar d:/orion/orion.jar
Orion/1.4.5 initialized
init() TestServlet@704baa
init() TestServlet@34fad5
done! TestServlet@704baa
doGet()
done! TestServlet@34fad5
doGet()

wich is not really what i want( expected). I haven't watched the specs so
i'm not sure if this is the correct behavior in a situation like that  i
would like to know what u people think about it.
If someone has also a workaround it will be very much appreciated.. ;)

I'm running orion on w2k (i tried 1.4.5  1.4.4, same behaviour for both).
Marco 



--

Ing. Marco Isella, Software Engineer
TINET SA, Via Violino 1, CH-6928 Manno-Lugano
tel. +41 91 612 22 22, fax. +41 91 612 22 23
email [EMAIL PROTECTED]
http://www.tinet.com





problem with load-on-startup SunOs

2001-01-24 Thread Marco Isella

I have a problem with load-on-startup on my SunOS machine..

in the init() of my HttpServlet i have 
   DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
   DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
   File temp = new File(xmlFile);
   Document doc = docBuilder.parse(temp);
In my web.xml i have 
load-on-startup 0 /load-on-startup
so that the servlet will be placed into service when orion starts..
With w2k it works fine but with the unix machine (SunOS 5.7) i have a 
java.io.IOException: Stream closed.
when the docBuilder try to parse the temp file

The same code is rexecuted whe the first user access the website  it works
without errors..

Any suggestion is appreciated.

Thanks
Marco
 

--

Ing. Marco Isella, Software Engineer
TINET SA, Via Violino 1, CH-6928 Manno-Lugano
tel. +41 91 612 22 22, fax. +41 91 612 22 23
email [EMAIL PROTECTED]
http://www.tinet.com