Re: Problem serializing JDK dynamic proxies

2008-04-06 Thread nlif

Hi Chris,

Thanks for the link. I found the following workaround: instead of placing my
Proxy object in the HttpSession, I put it in a serializable wrapper class
first, and then put the wrapper in the HttpSession. The wrapper overrides
the default de-serialization to set a different class-loader as the
thread-local class-loader. Now, session replication completes without
throwing the exception. 

Here is the code of the Wrapper:

public class ProxyWrapper implements Serializable
{
private Object Proxy;

public ProxyWrapper(Object proxy)
{
Proxy = proxy;
}

public Object getProxy()
{
return Proxy;
}

private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();

try
{
ClassLoader myCl = this.getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(myCl);
in.defaultReadObject();
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
}
}
}

IMHO, this, as well as the dynamic-proxy documentation, implies there is a
problem in Tomcat's session-replication implementation.


Naaman
-- 
View this message in context: 
http://www.nabble.com/Problem-serializing-JDK-dynamic-proxies-tp16467407p16521737.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
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: Newbie: Question about first Servlet

2008-04-06 Thread Alan Chaney

Actually

ISO-8851-1 according to Google is a standard determining the moisture 
content of butter.



http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=35218


However, ISO-8859-1 is the Latin character set definition.

Probably ISO-8859-1 is more relevant. Anyway, you fixed it! Hope you 
have hours of fun learning servlet programming just like the rest of us...



Regards

Alan Chaney




Kurt L Harless wrote:

OK, figured it out.

I changed the Character Set to

?xml version=1.0 encoding=ISO-8859-1?

Instead of 


?xml version=1.0 encoding=ISO-8851-1 ?

I figured this out by using the tomcat.exe to start the service and saw the
dump message when it was trying to parse my xml file.

Is this not the valid way of coding this encoding?

-Original Message-
From: Kurt L Harless [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 05, 2008 10:14 PM

To: users@tomcat.apache.org
Subject: Newbie: Question about first Servlet

Greetings,

 


Specifics:

Window XP

TomCat 5.5

Java 1.6

 


Created webapp dirs under;

 


C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\

 


Called ch1\WEB-INF\classes

 


In WEB-INF at created a web.xml file with the following contents;

 


?xml version=1.0 encoding=ISO-8851-1 ?

web-app xmlns=http://java.sun.com/xml/ns/j2ee;

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

version=2.4

servlet

servlet-nameChapter1 Servlet/servlet-name

servlet-classCh1Servlet/servlet-class

/servlet

servlet-mapping

servlet-nameChapter1 Servlet/servlet-name

url-pattern/Serv1/url-pattern

/servlet-mapping

/web-app

 


In the classes subdir to WEB-INF I compile the following java src
successfully

 


import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

 


public class Ch1Servlet extends HttpServlet

{

public void doGet(HttpServletRequest request,
HttpServletResponse response)

throws IOException 


{

PrintWriter out = response.getWriter();

java.util.Date today = new java.util.Date();

out.println(html  +

body +

h1 align=centerHF\'s Chapter1
Server/h1 +

br + today + 

/body + 


/html);

}

}

 


I installed TomCat 5.5 as a windows server and can successfully launch
http://localhost:8080 http://localhost:8080/  and get the TomCat initial
page

Under this page I can select the link for TomCat manager and see under
applications an entry for /ch1

 


However, when I try to run  http://localhost:8080/ch1/Serv1
http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1

 


Anyone want to help a newbie?

 

 




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



!DSPAM:47f86177141196657853550!



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



security with tomcat-users.xml

2008-04-06 Thread sex
I'm trying to give myself access to the manager web app, but have been 
unsuccessful.  My tomcat-users.xml looks like this:

?xml version='1.0' encoding='utf-8'?
tomcat-users
  role rolename=manager/
  role rolename=admin/
  user username=chris password=chris roles=admin,manager/
/tomcat-users

but I always get a 401 Unauthorized error.  Any ideas?




FileUpload problem (HTTPS)

2008-04-06 Thread Lars Nielsen Lind

Hi,

I have some problems with FileUpload. When I use it in my development 
environment with SSL and from the same network, there are no problems. 
But when I use it in my production environment from another network, I 
get this error message:


FileUploadBase$InvalidContentTypeException: the  request doesn't 
contain a multipart/form-data or multipart/mixed stream,  content type 
header is null


Are there any known solutions to this problem?

thanks,

Lars

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



SSL IE vs Opera war

2008-04-06 Thread Max Sevenfold

Hello,

Opera dislikes low encryption. It works only when I add

  ciphers=TLS_RSA_WITH_AES_256_CBC_SHA

But it stops IE 7.
IE 7 uses

TSL_RSA_WITH_RC4_128_MD5

We tries following so far

  ciphers=TLS_RSA_WITH_AES_256_CBC_SHA,TSL_RSA_WITH_RC4_128_MD5
  ciphers=TSL_RSA_WITH_RC4_128_MD5,TLS_RSA_WITH_AES_256_CBC_SHA
  ciphers=TLS_RSA_WITH_AES_256_CBC_SHA,ALL

Server responds Handshake Filure when IE 7 connects.

IE 7 works with

ciphers=TSL_RSA_WITH_RC4_128_MD5
or with no ciphers attribute.

It seems to be Tomcat error as it does not wish to select 
TSL_RSA_WITH_RC4_128_MD5 when IE 7 connects.

or select Opera's favorite TLS_RSA_WITH_AES_256_CBC_SHA when Opera connects.

Is there any solution?

I have Tomcat 6.0.14 with no APR and no NIO.
I use Java 6 u3 or u4 with Strong Encryption.


   Connector port=6443 protocol=HTTP/1.1 SSLEnabled=true
  maxThreads=150 scheme=https secure=true
  keystoreFile=conf/keystore.tomcat
  keystorePass=changeit
  keystoreType=PKCS12
  clientAuth=false sslProtocol=TLS
   
  ciphers=TSL_RSA_WITH_RC4_128_MD5,TLS_RSA_WITH_AES_256_CBC_SHA
 
  compression=on

  compressionMinSize=2048
  noCompressionUserAgents=gozilla, traviata
  
compressableMimeType=text/html,text/xml,text/javascript,text/css,text/javascript,text/plain

  /




Thanks,
Max




-
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: web.xml pbm

2008-04-06 Thread supareno

i found the problem !!
i tried a war without a context and everything is working find (but i 
didn't have a db connection !!)

so i tried with a context (like the example below)

?xml version=1.0 encoding=UTF-8?
Context path=
   reloadable=true
   docBase=
   Resource
   name=jdbc/library
   auth=Container
   type=javax.sql.DataSource
   username=javadude
   password=javadude
   driverClassName=com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/mydb?autoReconnect=true/
/Context

i although set a resource in the web.xml

resource-ref
descriptionLibrary Connection/description
res-ref-namejdbc/library/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref


and nothing worked !! it listed the webappas folder
i may forget to say that it is a struts app !

i don't know why it is not working.

On Fri, Apr 4, 2008 at 4:49 AM, supareno [EMAIL PROTECTED] wrote:

  

 i write a build.xml file to build and deploy my war. (compilation OK and
deployment on the server OK)
 but, when i try to start it, it starts but when i try to access to it, i'm
only seeing the list of the apps prrsents in the webapps folder !



That suggests to me that your basic config is wrong -- like, you have
an overlapped appBase/docBase somewhere. You might want to
post your Host entries from server.xml and the context.xml of your
app.

  



-
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: web.xml pbm

2008-04-06 Thread Caldarale, Charles R
 From: supareno [mailto:[EMAIL PROTECTED] 
 Subject: Re: web.xml pbm
 
 so i tried with a context (like the example below)
 ?xml version=1.0 encoding=UTF-8?
 Context path=
 docBase=
 /Context

If your Context element is in the proper place (META-INF/context.xml
of your webapp), then neither the path nor the docBase attributes are
allowed.  Even if your Context element is in server.xml (and none
should be), a docBase attribute of  is *never* correct - that is
likely contributing to your problem.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
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: security with tomcat-users.xml

2008-04-06 Thread Caldarale, Charles R
 From: sex [mailto:[EMAIL PROTECTED] 
 Subject: security with tomcat-users.xml

Why is it so hard for people to tell us what Tomcat version they're
working with?

 but I always get a 401 Unauthorized error.

Did you restart Tomcat after making the change?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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



Usage of Hibernate

2008-04-06 Thread Sam Wun
Hi,

I am new to Hibernate.
From googl'ing around, I found that Hibernate is designed for mapping object 
classes and database.
But this doesn't entirely solve my puzzle on this framework, that is what it's 
distinct advantage over simple usage of JDBC?
UnlessHibernate has another important/popular usage rather than only 
dealingwith database, I would think this is may be the only reason whyHibernate 
getting more popularity.
Can anyone tell me?

Thanks
Sam






  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Adding transactional classloader for dynamic code in webapp?

2008-04-06 Thread David Wall
I'd like to allow a web app to define custom code, such as for custom 
data validators or data formatters to be added by a user through 
configuration in my web app. 

That is, I'd like to have a user of my web app specify some Java code 
snippets (either a few lines of code, or perhaps a complete method) that 
my base code would call back to do customized data validations if they 
have been configured in my web app.  An example would be a form that 
needs to validate a phone number, but some want a strict NPA-NXX- 
style format, others allow phone extensions, others may allow an 
optional country code prefix, etc.  So I'd like my based code to be able 
to do something like call a method the user has defined that follows a 
naming convention, such as


boolean validatePhone(String phone)

and it would then do the code check set by the user who perhaps only 
filled in the code snippet into a textarea in my JSP and I've saved to 
the database.


My guess is I'd need to develop some sort of transactional class loader, 
one that would be created after dynamically generating the Java code, or 
compiling the Java code entered and storing the resulting .class file, 
etc.  But since they could change the code through my web app, I would 
need to be able to auto-recompile (sort like a JSP does in Tomcat) and 
by recreating a new classloader on the fly, it would obsolete the old 
code during garbage collection and would use the new code going forward.


Is there any place that I can read about some proven approaches to this 
sort of dynamic Java class creation, compilation, class loader?  Tips? 


Thanks,
David

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