RE: Can't rename a file using renameTo()

2005-06-22 Thread Paul French
Hello,

Just a thought but I believe renameTo only works if you are renaming the
file in the same disk volume. If you try and do this across disk volumes
then this is effectively a copy and the renameTo does not work. This
maybe your problem.

Paul

-Original Message-
From: Christoph Kutzinski [mailto:[EMAIL PROTECTED] 
Sent: 22 June 2005 08:38
To: Tomcat Users List
Subject: Re: Can't rename a file using renameTo()

Hi,

I would guess that there is a security policy in JBoss that prevents 
JBoss (and its integrated Tomcat) from writing outside some special 
directories (e.g. its working directory and the temp directory).
There is surely a way to lessen this security restriction, but that is 
obviously a JBoss question. You should ask for more help in a JBoss 
forum/mailing list (or probably just reading the JBoss configuration 
documentation would help, too)


Christoph

Kam Lung Leung wrote:
 Hi Jason,
 
 Thank you for the information. It is a long paragraph. I checked the
/SomeDirectory again, and it is the same name. I was able to create
directory with the mkdir -p 
 /SomeDirectory/firstSubdirectory/secondSubdirectory and manually
created a file by this command 
 touch /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile .
The Servlet was able to create directories under the /SomeDirectory
directory. For example, the Servlet was able to create 
 /SomeDirectory/firstSubdirectory/secondSubdirectory directories. But
the Servlet can't rename the file named oldFile under the /tmp directory
to /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile. The
Servlet did created all directories under the /SomeDirectory by not able
to move the oldFile to the that directory. The same code work fines what
it run without the Jboss running in the same server.
 
 Kam
 
 
 
 
 
  Jason Bainbridge [EMAIL PROTECTED] wrote:
 
On 6/21/05, Kam Lung Leung [EMAIL PROTECTED] wrote:

Hi,

I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to
/someDirectory/newFile. The Servlet-A runs fine when it runs by itself
in a Red Hat Linux 7.2 server that has jakarta-tomcat-4.1.30 running.
However, it false to rename the /tmp/oldFile to /someDirectory/newFile
when the Servlet-A run (within the jakarta-tomcat-4.1.30) in a Red Hat
Linux 7.2 server box that also has jboss-3.2.1_tomcat-4.1.24 running. I
thought it may be privilege issue so I set the /someDirectory directory
with chmod -R 777 and run Tomcat as a root user. But, it is still
false to rename the /tmp/oldFile file to the /someDirectory/newFile.

The strange thing is that the Servlet-A was able to write the oldFile
to the /tmp directory but can not rename the oldFile to the
/someDirectory directory that was allowed for writing for ALL user
levels. Can this be Jboss prevented the rename operation. I used the
canRead and canWrite to check allowable action by the File. It turns out
that the Servlet-A can read and write the /tmp/ oldFile. But the
Servlet-A can't read or write the /someDirectory/newFile.

The strangest thing is that when the Servlet-A runs in a Red Hat
Linux 7.2 server that has ONLY jakarta-tomcat-4.1.30 running, the
condition of canRead and canwrite are the same. Meaning that the
Servlet-A was able to read, and write the oldFile. But can't read, and
write the newFile. However, the renameTo() method returned true and the
Servlet-A was able to rename the /tmp/oldFile into
/someDirectory/newFile.

It took me a few reads to even come close to following all that but is
it possibly that you are trying to copy a subdirectory within /tmp to
a subdirectory of /someDirectory that doesn't exist?


-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 Buy your train tickets for business and leisure the easy way at 
www.thetrainline.com http://www.thetrainline.com/


This email has been sent from Trainline Holdings Limited, or from one of its 
group companies. The information in this email (and any attachments) is 
confidential and is intended solely for the use of the individual or entity to 
whom it is addressed. Access to this email by anyone else is unauthorised. If 
you are not the intended recipient please do not disclose, copy, distribute, or 
take any action in reliance on it. If you received this email in error please 
tell us by reply email (or telephone the sender) and delete all electronic 
copies on your system or other copies known to you.

Whilst we have taken reasonable precautions to ensure that this email and any 
attachments have been 

RE: SessionId across webapps in tomcat

2003-02-19 Thread Paul French
Not sure how tomcat implements its session management using cookies. It
would make sense to keep web apps separate (i.e have their own session
cookie).

If you create your own cookie have you tried explicitly setting the path of
the cookie to '/'. Perhaps tomcat defaults the path of a cookie to the root
of the web application (I'm guessing here!!). It should then be visible to
all webapps on the same domain.

-Original Message-
From: Robin de Villiers [mailto:[EMAIL PROTECTED]] 
Sent: 19 February 2003 18:35
To: Tomcat Users List
Subject: Re: SessionId across webapps in tomcat

I'm trying to use the JSESSIONID cookie to synchronize the data across
sessions.

I tried to use a different cookie but all cookies are dropped when you
change from one webapp to another. (That is the Cookie header isn't included
in the request).  The webapps are running on the same machine, no
clustering.  The domain is the same.

Cheers

Robin


- Original Message -
From: Sean Dockery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 18, 2003 12:36 PM
Subject: Re: SessionId across webapps in tomcat


 Hello, Robin.

 What do you mean when you say that your cookie didn't make it across the
 divide?  Could you not access your cookie in the other web application?
How
 are you trying to synchronize the sessions between the web applications?
 Are the web applications running in the same domain?  Are the web
 applications running on the same machine in a non-clustered environment?


 --
 Sean Dockery
 [EMAIL PROTECTED]
 Certified Java Web Component Developer
 Certified Delphi Programmer
 SBD Consultants
 http://www.sbdconsultants.com

 Robin de Villiers [EMAIL PROTECTED] wrote in message
 006701c2d79c$b9ba9cc0$dabe24c4@malbec">news:006701c2d79c$b9ba9cc0$dabe24c4@malbec...
 Hi

 I have a problem with sessions not being carried across multiple webapps.
I
 realise that the specification prevents this.  However I have come across
 some hacks for this rule.
 1. Have a static hashtable in the tomcat classloader space used by
 individual webapps.  This works but I have the problem that the JSessionId
 isn't carried across webapplications.  So although I can move a value
across
 the gap, I cannot safely tie a value to a session in order to retrieve the
 correct value.
 2. Implement the crossContext mechanism used in tomcat. Unfortunately I
 don't think this is 'session safe'.  Please correct me if I am wrong.  (So
 back to no 1s problem)
 3. I've tried adding my own cookie, but my cookie didn't make it across
the
 'divide' either.
 4. carry the value across in the query string.  I can't do this because it
 means modifying every link on every application and is a security risk.



 I'm thinking of creating a Valve for use with tomcat but I can't afford
the
 developement time for this.

 What I want to do is create an object and place it in the session that
 contains user information, group information, skin support, language
support
 and permissions.

 The SingleSignOn doesn't seem to cater for this set of data.  The valve
must
 filter based on the permissions in this object.  And the object must be in
 the session
 for web pages to access in order to present only-allowed links.  I'm using
 ldap to store all of this information.  Finally I'm not interested in
 specifying security constraints in the web.xml file because I want to
 specify this stuff in LDAP related to a user's role.

 The reason I want this in LDAP is for maintainance purposes.


 So please send me any comments either on preserving a session id accross
 webapps, or on the applicability of using a Valve or ease or difficulty of
 developing one for use in this context.


 I would appreciate any help.

 Robin

 PS I've tried resin, but have had similar results.













 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: RE: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF

2003-02-13 Thread Paul French
The pool manager won't close a connection being used.

I use oracle jdbc and I have found if I do the following I do not get any
problems

During the doGet or doPost

{
try {

  Get a connection from the pool

  Prepare a statement
  Execute and get a result set

  Close the result set when finished (I read somewhere Oracle can't
guarantee to clean up all cursors if you simply close the prepared statement
although most of the time it does)

  Close the prepared statement

  }
  catch (SQLExceptions e)
  {
Check all result sets and prepared statements are closed (need to put
try blocks around each in case of further sql exceptions - simply ignore the
exception)
  }
  finally {
// return the connection to the pool
if (conn!= null) {
  try
  {
conn.close();
  }
  catch (SQLException ignore){}
}
  }


Like your self I would be interested in any documentation on the Commons
database pool manager.


-Original Message-
From: Chakravarthy, Sundar [mailto:[EMAIL PROTECTED]] 
Sent: 13 February 2003 16:03
To: Tomcat Users List
Subject: RE: RE: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF

Could you tell me how to force Tomcat to  close connections sooner ?

Also where can I find the documentation for all the parameters I could
set in the xml file ?

Another question:

Say I have the following statements,


1 System.out.println(Creating connection.);
2 conn = dataSource.getConnection();
3 System.out.println(Creating statement.);
4 stmt = conn.createStatement();

What prevents the Pool Manager from closing the connection in line 2
before line 4 is reached ?

Thanks,
Sundar

-Original Message-
From: Robert Dana [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 05, 2003 1:16 PM
To: [EMAIL PROTECTED]
Subject: Re: RE: Oracle cursor problem with Tomcat 4.1.12 and Commons
BDSF

Not sure if this is any help, but I do have some related information.  I
believe the problems you are experiencing relate directly to a known bug
in the Oracle JDBC drivers.  In my case, I found that using a
PreparedStatement object in a servlet resulted in 2 or 3 (depending on
the complexity of the statement) overhead cursors being opened by
Oracle.  These cursors did not close, even when the PreparedStatement
itself was closed in my code.  The orphan cursors only seemed to close
if the connection itself was closed -  a major problem if one is trying
to use any kind of efficient connection pooling.  This problem has been
acknowledged by Oracle, but they have not, to my knowledge, fixed it.
For me, the best solution was to de-tune my connection pool to force
connections to be closed sooner than I normally would, in combination
with setting a very high value for MAXCURSORS in the init.ora file.
After some experimentation, I found a combination of those 2 factors
that resulted in no more maximum open cursors errors, with only a
modest degradation in performance.  A compromise solution to be sure,
but one that worked out OK for me.

I hope that is useful information.

Robert Dana

-Original Message-
From: Tam, Michael [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Date: Tue, 4 Feb 2003 18:48:16 -0500 
Subject: RE: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF

Maybe you can post a segment of the code or example to illustrate your
problem.

Michael

-Original Message-
From: Andy Meadows [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 2:25 PM
To: Tomcat Users List
Subject: Re: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF


Doing that.

Actually, further testing reveals that the problem occurs with the
statement.  If an exception occurs while the statement is being
prepared,
then an exception is thrown.  However, it would appear that this
exception
is thrown after a cursor is opened (internally) and that cursor is never
closed.  A call to close on the statement in turn throws a NPE because a
value was never assigned to it.  Thus, I'm left with an open cursor on
an
object that I can't reach.

Can anyone else validate this?

Andy



- Original Message -
From: Tam, Michael [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, February 04, 2003 4:22 PM
Subject: RE: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF


 Have seen this problem before.
 It is the JDBC code.  The best solution is to explicitly close
RESULTSET,
 STATEMENT (of any kind), and CONNECTION as soon as you finished using
the
 object ( or else close them in the FINALLY block)

 Regards,
 Michael

 -Original Message-
 From: Sean Dockery [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 04, 2003 1:04 PM
 To: Tomcat Users List
 Subject: Re: Oracle cursor problem with Tomcat 4.1.12 and Commons BDSF


 Try explicitly closing your ResultSet variables as well.  See if the
 problem persists.

 At 13:58 2003-02-04, you wrote:
 Configuring Tomcat to provide a JNDI 

RE: Digested Passwords and Oracle 8.1.7

2002-10-22 Thread Paul French
As far as I'm aware Oracle use their own propriety encryption algorithm and
do not provide any mechanism to encrypt a password so that you can compare
with passwords in the oracle data dictionary. I think the only answer is to
implement your own user/password functionality and encrypt the password
yourself using a standard algorithm.

Paul

-Original Message-
From: Graham Lounder [mailto:lounder;caris.com] 
Sent: 22 October 2002 13:35
To: Tomcat Users List
Subject: RE: Digested Passwords and Oracle 8.1.7

I need the algorithm so I can encrypt a password.  The Tomcat Realm would
then compare the encrypted password to the encrypted password in the
database.  I don't need to decrypt the password.

Graham

-Original Message-
From: Wagoner, Mark [mailto:MWagoner;wild-flavors.com]
Sent: October 22, 2002 9:32 AM
To: 'Tomcat Users List'
Subject: RE: Digested Passwords and Oracle 8.1.7


I don't think you are supposed to be able decrypt the passwords.  In fact, I
would hope that you can't or Oracle would have a big problem.

-Original Message-
From: Graham Lounder [mailto:lounder;caris.com]
Sent: Tuesday, October 22, 2002 8:28 AM
To: [EMAIL PROTECTED]
Subject: Digested Passwords and Oracle 8.1.7


Hey all!

I was wondering if any has ever tried to use a Tomcat Realm directly to
Oracle's Username/Password table.

I found the table in SYSTEM.DBA_USERS which has the username and encrypted
password.  The problem is, I have no way of digesting the password.  Does
anyone know the algorithm Oracle uses to encrypted their passwords?  I've
checked MD5 and SHA but they don't seem to be it.  I tried MD2 but it Tomcat
doesn't seem to like it.

Any Ideas?

Thanks in advance,
Graham


  Graham Lounder
  Java Developer
  Spatial Components Division
  CARIS
  264 Rookwood Ave
  Fredericton NB E3B-2M2
  Office 506 462-4263
  Fax506 459-3849
  [EMAIL PROTECTED]
  http://www.spatialcomponents.com



--
To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org

--
To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org


--
To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org

--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




RE: My Start and Stop Tomcat windows do not stay up

2002-10-21 Thread Paul French
Try running catalina.bat run (instead of startup.bat) and you should see all
messages in the same console window. That way you can see what might be
wrong with your server.xml or web.xml file

Paul

-Original Message-
From: [EMAIL PROTECTED] [mailto:AnnWenzel;aol.com] 
Sent: 21 October 2002 17:41
To: [EMAIL PROTECTED]
Subject: Re: My Start and Stop Tomcat windows do not stay up

Jake

In response to your following suggestion:

Are you sure that Tomcat isn't already running as a service?  If
Tomcat is already listening to the ports that a new instance would
try to listen to, then you would get that behavior.  The window would
just close.  For easier debugging, you might want to open a command
prompt and cd to where the tomcat startup batch files are and run them
via the command line rather than double clicking the batch files.
That way, you should see some error messages in the console.

I ran the startup.bat file and got the same behavior.  I see results on
the 
screen for a second, then the screen disappears.  The shutdown results
do 
stay in the original window.  However, I'm getting error message
connected 
with the sshutdown.  Here they are:

C:\Tomcat\Tomcat 4.1\binshutdown
Using CATALINA_BASE:   c:\Tomcat\Tomcat 4.1
Using CATALINA_HOME:   c:\Tomcat\Tomcat 4.1
Using CATALINA_TMPDIR: c:\Tomcat\Tomcat 4.1\temp
Using JAVA_HOME:   c:\j2sdk1.4.1
Catalina.stop: java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at 
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at java.net.Socket.init(Socket.java:291)
at java.net.Socket.init(Socket.java:119)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:579)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.j

ava:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

What is the cause of this exception?  What do I need to do to fix it?

Thanks for your help 

Ann

--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




port numbers for http and https

2002-10-14 Thread Paul French

How do you find out both port numbers (http and https) within a servlet that
tomcat is listening on?
 
I know I can use getSeverPort() to get  the port number of the current
request!
 
Paul