Re: Tomcat 6.0 in Eclipse

2009-03-17 Thread Ingmar Lötzsch

I downloaded apache-tomcat-6.0.16 and ran the startup.bat. I could see the
page display at http://localhost:8080/

Later, I configured the same in eclipse 3.4 and started the tomcat using
eclipse.Eclipse started the tomcat with no exception.
However, when I go to the page at http://localhost:8080/ I see HTTP Status
404 error.


The plugin you use inside Eclipse starts Tomcat with a different 
configuration including an "empty" ROOT context. If you develop with the 
WTP plugin, look at


\.metadata\.plugins\org.eclipse.wst.server.core

and than for example

\tmp0\conf\server.xml

or

\tmp0\wtpwebapps

Ingmar

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Variable returning context name

2009-01-28 Thread Ingmar Lötzsch
> is there  an tomcat (5.5x) variable which gives back the context name such
> as webappRoot returns the path to the webapp!?
> I plan to use this to specify an logfile such as
> log4j.appender.logfile.File=${log.dir}/${contextnamevariable}_test.log

I'am using ServletContext.getContextPath() inside a
ServletContextListener implementation.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: PostgreSQL vs MySQL with Tomcat

2009-01-16 Thread Ingmar Lötzsch
Some comments (and answers to Christopher and Rusty) on PostgreSQL:

In 2004 our team decided to use PostgreSQL instead of the well-known
MySQL (current version 4). The main reasons where

- real referential integrity
- real transactions
- support for UTF-8 enoding
- better compliance with the SQL standard

> The one warning I can think of with PostgreSQL is that you have to use
> schemas; you either have to set the schema after you connect, and I
> think I couldn't figure out how to do that with jdbc, or you specify it
> as part of every table name; "create table schema_name.table_name ...;
> select whatever from schema_name.table_name;".  Schemas are quite cool,
> so don't take this as a criticism.

This isn't true. You can (and perhaps should) always omit the schema.
The default schema "public" is used in this case. You can execute

CREATE TABLE foo
(
id serial NOT NULL PRIMARY KEY,
description text NOT NULL
);

>NOTICE:  CREATE TABLE will create implicit sequence "foo_id_seq" for
serial column "foo.id"
>NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"foo_pkey" for table "foo"

INSERT INTO foo (description) VALUES ('foo');
SELECT * FROM foo;

>1;"foo"

SELECT currval('foo_id_seq');

>1

In the persistende layer we have switched from JDBC to iBATIS.

There you have the SQL statements organized in XML files. One approach
for INSERT is



SELECT nextval('foo_id_seq')

INSERT INTO foo (id, description)
VALUES
(
#id:INTEGER#,
#description:VARCHAR#
)


In the DAO implementation you have

public Integer insert(Foo foo)
{
Integer id = (Integer) getSqlMapClientTemplate().insert("foo.insert", 
foo);
return id;
}

or simply

public void insert(Foo foo)
{
getSqlMapClientTemplate().insert("foo.insert", foo);
}

After the call the Foo instance contains the generated ID in both cases.

We didn't need much support for PostgreSQL. The documentation is
comprehensive. The installation under Windows is easy. The installation
unter UNIX systems can have some difficulties.

Ingmar

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how to invalidate old sessions when new user access appl on same machine

2008-12-19 Thread Ingmar Lötzsch
Hello,

you can use the Sevlet API. First call invalidate() on the actual
HttpSession instance and then getSession(true) on the request object
(HttpServletRequest) to start a new session.

Nicolas Romantzoff schrieb:
> Thats a problem in your server code...
> 
> Session is binded to a connection (browser session) basically, not a
> machine.
> If you open a second browser (or a second tab) you should get a different
> session-id.

That's dependent on the browser and maybe the user settings. I'am using
Firefox and I'am happy, that Firefox uses the same session in all
windows for the same host.

> Don't use JSESSIONID in url parameters, but in session cookie (unless you
> need to cross protocols like http <-> https)

Shouldn't this be transparent to the developper?

> For security, you will have to bind an 'ending' date to the session's
> authentication.

Isn't the session timeout enough?

> Nicolas Romantzoff
> General Manager
> Tél.: (+33) 478 53 65 17 
> 
> 
> -Original Message-
> From: Vishnu Vardhana Reddy [mailto:vishnu...@gmail.com]
> Sent: Friday, 19 December, 2008 12:55
> To: users@tomcat.apache.org
> Subject: how to invalidate old sessions when new user access appl on same
> machine
> 
> 
> hi all,
> 
> I am using Mozilla browser to access my web application.User one access my
> application using his credentials .but i left that browser open.after that I
> am opening the another Mozilla window and accessing my application using
> different credentials ex:user2 credentials .user 2 also can access my
> application.but when i open the first browser ..am automatically getting
> second user session.how can we avoid this problem.
> 
> Application is using session identifier(jSessionID) as the URL parameter for
> session management.
> 
> is it possible to invalidate the old session when new user access on same
> machine.
> 
> thanks,
> Vishnu
> --
> View this message in context:
> http://www.nabble.com/how-to-invalidate-old-sessions-when-new-user-access-ap
> pl-on-same-machine-tp21090090p21090090.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> 
>   _  
> 
> avast! Antivirus  : Outbound message clean. 
> 
> 
> Virus Database (VPS): 081218-0, 2008-12-18
> Tested on: 2008-12-19 13:54:20
> avast! - copyright (c) 1988-2008 ALWIL Software.
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Log4j Date/time logging

2008-08-19 Thread Ingmar Lötzsch

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

## see PatternLayout
## %d{ISO8601} = -MM-dd HH:mm:ss,SSS
## %d{ABSOLUTE} = HH:mm:ss,SSS
## %-5p = level, left aligned, minimum 5 characters
## %c{1} = last part of the name of the logger
## %m = message
## %n = newline (platform dependend)
## example
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %-5p 
%c{1}:%n%m%n


Tokajac schrieb:

How can i simply log the date and the time in each line?
I found several examples around, but none of them works


Regards


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSF implementation selection

2008-05-09 Thread Ingmar Lötzsch

Is it possible to use Icefaces and Tomahawk together?

Thank you
Ingmar

Praful Sinha schrieb:

Icefaces provides you a functionality of ajax embedded in it.
But Myfaces did not.

You can also you tomahawk for more enhanced tag lib.

Any trouble can contact me on [EMAIL PROTECTED]

Praful Sinha.

-Original Message-
From: itay sahar [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 09, 2008 8:09 PM

To: users@tomcat.apache.org
Subject: JSF implementation selection

hi all,
I would like you share with us the best JSF implemetation.
(myfaces,icefaces) and explian
why you prefer one above the other.

Thanks
Itay



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: where to put config file in a webapp

2008-04-02 Thread Ingmar Lötzsch
I forgot to change line 113:

old version
Object[][] contents = resources.toArray(new Object[0][0]);

new version
Object[][] contents = resources.toArray(emptyObjectArray);

Ingmar

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: where to put config file in a webapp

2008-04-02 Thread Ingmar Lötzsch
You also can use ResourceBundle (if you need only Strings) or
ListResourceBundle.

1. ResourceBundle

Save your configuration in com.x.y.z.MyConfig.properties (or in the
default package)
In your Java class type

ResourceBundle bundle = ResourceBundle.getBundle("com.x.y.z.MyConfig");
(= ResourceBundle.getBundle("MyConfig") in case of the default package;
String value1 = bundle.getString("key1");

2. ListResourceBundle

You have to overwrite the getContents() method.

I wrote the following class CommonListResourceBundle that can be
parameterized with the name of the bundle and therefore reused (Excuse
the german comments):

package com.asci.common.util;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.ListResourceBundle;
import java.util.ResourceBundle;

/**
 * Die Klasse stellt die in der Ressourcendatei mit dem durch den
Parameter bundleName übergebenen
 * Namen enthaltenen Inhalte als Objekte zur Verfügung. Die in der
Ressourcendatei abgelegten Werte
 * müssen ein durch Komma abgetrenntes Präfix haben, das den zu
erzeugenden Typ angibt.
 * Unterstützt werden nur Typen aus dem JDK, und zwar
 * string -> java.lang.String
 * int -> java.lang.Integer
 * long -> java.lang.Long
 * double -> java.lang.Double
 * color -> java.awt.Color
 * font -> java.awt.Font
 * dimension -> java.awt.Dimension
 * date -> java.sql.Date
 *
 * Für Boolean wird einfach "true" oder "false" angegeben.
 *
 * Beispiele:
 *
 * param1=int,1
 * param2=string,de_DE
 * param3=true
 * param4=color,255,255,255
 */
public class CommonListResourceBundle extends ListResourceBundle
{
protected final static Object[][] emptyObjectArray = new Object[0][0];

protected String bundleName;

public CommonListResourceBundle(String bundleName)
{
this.bundleName = bundleName;
}

/**
 * Die Methode liefert abgeleiteten Klassen die Standardtypen, so dass
dort nur noch die
 * speziellen Objekte angehangen werden müssen.
 * @return eine Liste aller Inhalte, die Standardtypen entsprechen.
 */
protected List getContentsAsList()
{
ArrayList resources = new ArrayList();
ResourceBundle bundle = 
ResourceBundle.getBundle(this.bundleName);
Enumeration keys = bundle.getKeys();
while (keys.hasMoreElements())
{
Object value = null;
String key = keys.nextElement();
String valueString = bundle.getString(key);
String[] tokens = valueString.split(",");
String type = tokens[0];
if (type.equals("string"))
{
value = tokens[1];
}
else if (type.equals("int"))
{
value = Integer.valueOf(tokens[1]);
}
else if (type.equals("long"))
{
value = Long.valueOf(tokens[1]);
}
else if (type.equals("double"))
{
value = Double.valueOf(tokens[1]);
}
else if (type.equals("true"))
{
value = Boolean.TRUE;
}
else if (type.equals("false"))
{
value = Boolean.FALSE;
}
else if (type.equals("date"))
{
value = Date.valueOf(tokens[1]);
}
else if (type.equals("color"))
{
value = createColor(tokens);
}
else if (type.equals("dimension"))
{
value = createDimension(tokens);
}
else if (type.equals("font"))
{
value = createFont(tokens);
}
resources.add(new Object[]{key, value});
}
return resources;
}

@Override
protected Object[][] getContents()
{
List resources = getContentsAsList();
Object[][] contents = resources.toArray(new Object[0][0]);

// Der folgende Block ist zum Testen aus ListRessourceBundle 
kopiert.
//  HashMap temp = new HashMap(contents.le