Problem to install APR Tomcat Native Library

2008-10-30 Thread Torsten.Romer
I am trying to install the APR Tomcat Native Library on a Solaris SPARC server.

Since it has only OpenSSL installed and no build system available, I compiled 
libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.

I then copied the lib folders of both libs to the server, and added the paths 
to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).

The message "The APR based Apache Tomcat Native library which allows optimal 
performance in production environments was not found [...]" and I can see the 
paths to both libs in the java.library.path.

I guess I have done something wrong. Any ideas? Can I change the logging level 
so I can get some more info in catalina.out?

Torsten

-
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: Problem to install APR Tomcat Native Library

2008-10-30 Thread Torsten.Romer
Hi Andrew,

Yes, I did that. So both libapr and libtcnative are in the 
LD_LIBRARY_PATH/java.library.path that Tomcat includes in the message that it 
couldn't load the library.

I even included the OpenSSL libs in the path.

Torsten

-Original Message-
From: Andrew Ralph Feller, afelle1 [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 18:18
To: Tomcat Users List
Subject: Re: Problem to install APR Tomcat Native Library


Torsten,

Have you updated your LD_LIBRARY_PATH to include APR lib?

A-


On 10/30/08 12:15 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> I am trying to install the APR Tomcat Native Library on a Solaris SPARC
> server.
> 
> Since it has only OpenSSL installed and no build system available, I compiled
> libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.
> 
> I then copied the lib folders of both libs to the server, and added the paths
> to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).
> 
> The message "The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found [...]" and I can see the
> paths to both libs in the java.library.path.
> 
> I guess I have done something wrong. Any ideas? Can I change the logging level
> so I can get some more info in catalina.out?
> 
> Torsten
> 
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Andrew R. Feller, Analyst
Information Technology Services
200 Fred Frey Building
Louisiana State University
Baton Rouge, LA 70803
(225) 578-3737 (Office)
(225) 578-6400 (Fax)


-
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: JSVC vs standard startup / shutdown scripts

2008-10-30 Thread Torsten.Romer
Hi Andrew,

We let all our Tomcats run on a non-privileged port and use some init script 
using startup.sh/shutdown.sh, and have an Apache httpd forwarding requests with 
AJP.

We then use Apache httpd for things like terminating SSL, do RADIUS or LDAP 
authentication, load balancing several Tomcat instances and so on.

I think it is a good and common setup like that.

Torsten

-Original Message-
From: Andrew Feller [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 18:16
To: users@tomcat.apache.org
Cc: Brad Cupit
Subject: JSVC vs standard startup / shutdown scripts

QUESTION: What is the best practice for running Tomcat?  JSVC daemon or
startup / shutdown scripts as a non-root user and forwarding HTTPS requests
to a non-privileged port?

While reading the Professional Apache Tomcat 6 (ISBN: 978-0-471-75361-2),
they recommend running Tomcat to start it up using the startup script
provided in the Tomcat binary and having your firewall forward requests from
HTTPS to a non-privileged port.  This is very interesting for two reasons:

   1. The book never mentions JSVC, which the Tomcat documentation does
   2. We believed using JSVC was the only way to run as a non-root user,
   which doesn't seem to be the case now

I would appreciate any feedback about the trade offs and why people choose
one over the other.

Thanks,
Andrew

-
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: Problem to install APR Tomcat Native Library

2008-10-30 Thread Torsten.Romer
Hi Martin,

It is Solaris SPARC. Would it help to copy shared libs into the JRE bin folder? 
I symlinked them into $JAVA_HOME/jre/lib/sparc but that didn't help either.

Torsten 

-Original Message-
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 18:34
To: Tomcat Users List
Subject: RE: Problem to install APR Tomcat Native Library


pls follow Andrew's advice..if windows its probably a dll? so you'll want to 
copy apr-1.lib to %JRE_HOME%\bin

Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


> Date: Thu, 30 Oct 2008 12:17:51 -0500
> Subject: Re: Problem to install APR Tomcat Native Library
> From: [EMAIL PROTECTED]
> To: users@tomcat.apache.org
> 
> Torsten,
> 
> Have you updated your LD_LIBRARY_PATH to include APR lib?
> 
> A-
> 
> 
> On 10/30/08 12:15 PM, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> 
> > I am trying to install the APR Tomcat Native Library on a Solaris SPARC
> > server.
> > 
> > Since it has only OpenSSL installed and no build system available, I 
> > compiled
> > libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.
> > 
> > I then copied the lib folders of both libs to the server, and added the 
> > paths
> > to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).
> > 
> > The message "The APR based Apache Tomcat Native library which allows optimal
> > performance in production environments was not found [...]" and I can see 
> > the
> > paths to both libs in the java.library.path.
> > 
> > I guess I have done something wrong. Any ideas? Can I change the logging 
> > level
> > so I can get some more info in catalina.out?
> > 
> > Torsten
> > 
> > -
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> Andrew R. Feller, Analyst
> Information Technology Services
> 200 Fred Frey Building
> Louisiana State University
> Baton Rouge, LA 70803
> (225) 578-3737 (Office)
> (225) 578-6400 (Fax)
> 
> 
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

_
You live life beyond your PC. So now Windows goes beyond your PC.
http://clk.atdmt.com/MRT/go/115298556/direct/01/

-
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: Problem to install APR Tomcat Native Library

2008-10-30 Thread Torsten.Romer
Yes, it is set to something like 
LD_LIBRARY_PATH=/opt/app/libtcnative/lib:/opt/app/apr/lib:$LD_LIBRARY_PATH

The files are all world readable and even owned by the user running Tomcat.

I just want to mention that I compiled both libs with another prefix than where 
I have copied them to now - because those directories don't exist on the build 
machine and I don't have root permissions. But that shouldn't matter since I 
include the locations of the libs in the LD_LIBRARY_PATH?

Is it not possible to get Tomcat to log some more details about loading these 
libs? Could be interesting to see some UnsatisfiedLinkError or so.

We have HTTP, HTTPS and AJP connectors on that Tomcat and what I understood 
from the documentation is that APR can improve the performance - which would be 
nice since the application is quite busy.

Thanks for all your help so far!

Torsten

-Original Message-
From: Andrew Ralph Feller, afelle1 [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 18:51
To: Tomcat Users List
Subject: Re: Problem to install APR Tomcat Native Library


Torsten,

What is your LD_LIBRARY_PATH set to?  Is it something like this:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib

Are there world permissions for anyone to read this directory?

I know you mentioned that you front-end Tomcat with HTTPD and assumed your
use of APR is to free Tomcat from depending on HTTPD for HTTPS.

A-
On 10/30/08 12:41 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> Hi Martin,
> 
> It is Solaris SPARC. Would it help to copy shared libs into the JRE bin
> folder? I symlinked them into $JAVA_HOME/jre/lib/sparc but that didn't help
> either.
> 
> Torsten 
> 
> -Original Message-
> From: Martin Gainty [mailto:[EMAIL PROTECTED]
> Sent: 30. oktober 2008 18:34
> To: Tomcat Users List
> Subject: RE: Problem to install APR Tomcat Native Library
> 
> 
> pls follow Andrew's advice..if windows its probably a dll? so you'll want to
> copy apr-1.lib to %JRE_HOME%\bin
> 
> Martin 
> __
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official business
> of Sender. This transmission is of a confidential nature and Sender does not
> endorse distribution to any party other than intended recipient. Sender does
> not necessarily endorse content contained within this transmission.
> 
> 
>> Date: Thu, 30 Oct 2008 12:17:51 -0500
>> Subject: Re: Problem to install APR Tomcat Native Library
>> From: [EMAIL PROTECTED]
>> To: users@tomcat.apache.org
>> 
>> Torsten,
>> 
>> Have you updated your LD_LIBRARY_PATH to include APR lib?
>> 
>> A-
>> 
>> 
>> On 10/30/08 12:15 PM, "[EMAIL PROTECTED]"
>> <[EMAIL PROTECTED]> wrote:
>> 
>>> I am trying to install the APR Tomcat Native Library on a Solaris SPARC
>>> server.
>>> 
>>> Since it has only OpenSSL installed and no build system available, I
>>> compiled
>>> libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.
>>> 
>>> I then copied the lib folders of both libs to the server, and added the
>>> paths
>>> to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).
>>> 
>>> The message "The APR based Apache Tomcat Native library which allows optimal
>>> performance in production environments was not found [...]" and I can see
>>> the
>>> paths to both libs in the java.library.path.
>>> 
>>> I guess I have done something wrong. Any ideas? Can I change the logging
>>> level
>>> so I can get some more info in catalina.out?
>>> 
>>> Torsten
>>> 
>>> -
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> 
>> 
>> -- 
>> Andrew R. Feller, Analyst
>> Information Technology Services
>> 200 Fred Frey Building
>> Louisiana State University
>> Baton Rouge, LA 70803
>> (225) 578-3737 (Office)
>> (225) 578-6400 (Fax)
>> 
>> 
>> -
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> 
> _
> You live life beyond your PC. So now Windows goes beyond your PC.
> http://clk.atdmt.com/MRT/go/115298556/direct/01/
> 
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Andrew R. Feller, Analyst
Information Technology Services
200 Fred Frey Building
Louisiana State University
Baton Rouge, LA 70803
(225) 578-3737 (Office)
(225) 578-6400 (Fax)


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

RE: JSVC vs standard startup / shutdown scripts

2008-10-30 Thread Torsten.Romer
> simpler = better

Fully agree. Keep it simple.

We however have to put an httpd in front in the DMZ anyway because our security 
people would never allow us to put any business logic there. And they want us 
to change protocol on the way to the application so the switch from HTTPS to 
AJP is good to calm them down.

Torsten

-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 19:55
To: Tomcat Users List
Subject: Re: JSVC vs standard startup / shutdown scripts


>
> I don't have any personal issue with moving to running Tomcat directly as
> the non-privileged account meant for Tomcat ...

Just to clarify, jsvc runs tomcat as an unprivileged user as well.  One
advantage to jsvc is it allows tomcat to be run by itself without funky
iptables rules or a front-end server.  It's a simpler setup and overall
I'm a firm believer in simpler = better.

--David

Andrew Ralph Feller, afelle1 wrote:
> Thanks for the response Torsten!
>
> In our environment, the machines we have Tomcat running on strictly use
> Tomcat 6, APR for SSL support, and we load balance applications through an
> external load balancer.  We have been able to get by without brining HTTPD
> for things like mod_rewrite or any of the PAMs, so I would like to keep it
> as simple as possible.
>
> I don't have any personal issue with moving to running Tomcat directly as
> the non-privileged account meant for Tomcat, however I am curious about the
> trade offs especially related to security.
>
> Thanks!
>
> On 10/30/08 12:37 PM, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>
>   
>> Hi Andrew,
>>
>> We let all our Tomcats run on a non-privileged port and use some init script
>> using startup.sh/shutdown.sh, and have an Apache httpd forwarding requests
>> with AJP.
>>
>> We then use Apache httpd for things like terminating SSL, do RADIUS or LDAP
>> authentication, load balancing several Tomcat instances and so on.
>>
>> I think it is a good and common setup like that.
>>
>> Torsten
>>
>> -Original Message-
>> From: Andrew Feller [mailto:[EMAIL PROTECTED]
>> Sent: 30. oktober 2008 18:16
>> To: users@tomcat.apache.org
>> Cc: Brad Cupit
>> Subject: JSVC vs standard startup / shutdown scripts
>>
>> QUESTION: What is the best practice for running Tomcat?  JSVC daemon or
>> startup / shutdown scripts as a non-root user and forwarding HTTPS requests
>> to a non-privileged port?
>>
>> While reading the Professional Apache Tomcat 6 (ISBN: 978-0-471-75361-2),
>> they recommend running Tomcat to start it up using the startup script
>> provided in the Tomcat binary and having your firewall forward requests from
>> HTTPS to a non-privileged port.  This is very interesting for two reasons:
>>
>>1. The book never mentions JSVC, which the Tomcat documentation does
>>2. We believed using JSVC was the only way to run as a non-root user,
>>which doesn't seem to be the case now
>>
>> I would appreciate any feedback about the trade offs and why people choose
>> one over the other.
>>
>> Thanks,
>> Andrew
>>
>> -
>> 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]


-
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: Problem to install APR Tomcat Native Library

2008-10-31 Thread Torsten.Romer
Hi Mladen,

> What does ldd libtcnative-1.so says?

libgcc_s.so.1 => (file not found) 

Thanks a lot! :-)

Torsten

-Original Message-
From: Mladen Turk [mailto:[EMAIL PROTECTED] 
Sent: 31. oktober 2008 10:25
To: Tomcat Users List
Subject: Re: Problem to install APR Tomcat Native Library


[EMAIL PROTECTED] wrote:
> I am trying to install the APR Tomcat Native Library on a Solaris SPARC 
> server.
> 
> Since it has only OpenSSL installed and no build system available, I compiled 
> libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.
> 
> I then copied the lib folders of both libs to the server, and added the paths 
> to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).
> 

What does ldd libtcnative-1.so says?

If you didn't use the Sun's CC but gcc to compile
you might be missing some gcc runtime libs on the target box

Regards
-- 
^(TM)

-
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: Problem to install APR Tomcat Native Library

2008-10-31 Thread Torsten.Romer
Now I finally got APR installed correctly :-) Thanks again for all the help!

However I get the following warnings when starting up Tomcat:

WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 
'minSpareThreads' to '25' did not find a matching property.
Oct 31, 2008 1:04:09 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 
'maxSpareThreads' to '75' did not find a matching property.
Oct 31, 2008 1:04:09 PM org.apache.catalina.startup.SetAllPropertiesRule begin

So it seems these properties are not supported by the APR protocol, but I can't 
confirm that reading the documentation. Also, the example for the APR SSL 
connector at

http://tomcat.apache.org/tomcat-6.0-doc/apr.html#HTTPS

includes these properties:



So why do I get these warnings? Should I remove the "minSpareThreads" and 
"minSpareThreads" properties or replace them by other ones?

Torsten



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 31. oktober 2008 12:38
To: users@tomcat.apache.org
Subject: RE: Problem to install APR Tomcat Native Library


Hi Mladen,

> What does ldd libtcnative-1.so says?

libgcc_s.so.1 => (file not found) 

Thanks a lot! :-)

Torsten

-Original Message-
From: Mladen Turk [mailto:[EMAIL PROTECTED] 
Sent: 31. oktober 2008 10:25
To: Tomcat Users List
Subject: Re: Problem to install APR Tomcat Native Library


[EMAIL PROTECTED] wrote:
> I am trying to install the APR Tomcat Native Library on a Solaris SPARC 
> server.
> 
> Since it has only OpenSSL installed and no build system available, I compiled 
> libapr 1.3.3 and libtcnative 1.1.14 on another machine with the same OS.
> 
> I then copied the lib folders of both libs to the server, and added the paths 
> to the LD_LIBRARY_PATH and restarted Tomcat (6.0.18).
> 

What does ldd libtcnative-1.so says?

If you didn't use the Sun's CC but gcc to compile
you might be missing some gcc runtime libs on the target box

Regards
-- 
^(TM)

-
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]


-
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: Problem to install APR Tomcat Native Library

2008-10-31 Thread Torsten.Romer
Hi Rainer,

I got it sorted out with ldd as suggested here on the list but it is certainly 
good to know about truss - thank you!

Torsten 

-Original Message-
From: Rainer Jung [mailto:[EMAIL PROTECTED] 
Sent: 30. oktober 2008 23:16
To: Tomcat Users List
Subject: Re: Problem to install APR Tomcat Native Library


[EMAIL PROTECTED] schrieb:
> Yes, it is set to something like
> LD_LIBRARY_PATH=/opt/app/libtcnative/lib:/opt/app/apr/lib:$LD_LIBRARY_PATH
> 
> 
> The files are all world readable and even owned by the user running
> Tomcat.
> 
> I just want to mention that I compiled both libs with another prefix
> than where I have copied them to now - because those directories
> don't exist on the build machine and I don't have root permissions.
> But that shouldn't matter since I include the locations of the libs
> in the LD_LIBRARY_PATH?
> 
> Is it not possible to get Tomcat to log some more details about
> loading these libs? Could be interesting to see some
> UnsatisfiedLinkError or so.

On Solaris you can use truss:

truss -f -o OUTPUTFILE TOMCATSTARTSCRIPT

It will e.g. show, which shared object files were tried to load and from
which places.

Regards,

Rainer

-
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: Does jsessionid on the URL also check the User-Agent?

2008-11-11 Thread Torsten.Romer
Hi Richard,

How do you log in and to what? What do you mean with it doesn't work? That 
Tomcat creates a new session?

I tried what you did: Accessed some webapp in FF and pasted the URL including 
jsessionid in IE - got the same session.

I don't think Tomcat cares about anything else than the jsessionid in the URL 
or the session cookie.

Maybe it is the authentication mechanism that does something with the session?

Torsten 

-Original Message-
From: kennardconsulting [mailto:[EMAIL PROTECTED] 
Sent: 12. november 2008 07:00
To: users@tomcat.apache.org
Subject: Does jsessionid on the URL also check the User-Agent?



Dear All,

When passing a jsessionid on the URL such as...

   http://foo.com;jsessionid=123

...does Tomcat do something clever, like checking the User-Agent, before
agreeing to hook into the existing '123' session?

If I log in using, say, Firefox and note the jsessionid, then open a new
Firefox and paste in a URL like the one above it works as expected. But if I
open IE and paste the same URL it doesn't work?

Does the URL rewriting check the User Agent? Can I turn this off?

Regards,

Richard.
-- 
View this message in context: 
http://www.nabble.com/Does-jsessionid-on-the-URL-also-check-the-User-Agent--tp20454717p20454717.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]


-
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: Using JAXB with tomcat

2008-11-12 Thread Torsten.Romer
I am not sure if this works and it is probably not a nice solution, but maybe 
you can do something like

BoOcorrenciaPolicial bo = (BoOcorrenciaPolicial)
unmarshaller.unmarshal(new File(XML_DIR + id + ".xml"));

Class clazz = bo.getClass();
Field field = clazz.getDeclaredField("hist");
field.setAccessible(true);

String hist = bo.getHist();

Like that you would at least not have to change the fields from protected to 
public.

Torsten

-Original Message-
From: Rafael Cunha de Almeida [mailto:[EMAIL PROTECTED] 
Sent: 12. november 2008 08:40
To: users@tomcat.apache.org
Subject: Using JAXB with tomcat


I have been trying to use JAXB with tomcat, but I have been have some
problems. I began trying to use the following class loader:

this.getClass().getClassLoader()

That didn't work. I don't actually understand much about those class
loader things. So I browsed the Internet for a solution and I found out
the following line:

Thread.currentThread().getContextClassLoader()

Then I plugged it into my JAXB initialization (br/sids/brh/jaxb is in
WEB-INF/class):

JAXBContext jc = JAXBContext.newInstance("br.sids.brh.jaxb",
Thread.currentThread().getContextClassLoader());
unmarshaller = jc.createUnmarshaller();

After some tomcat permissions tweaking I finally get that line working.
I was happy for a while, that is until I tried to actually get some
information from the XML. I used the following, very simple, just to
test it:

BoOcorrenciaPolicial bo = (BoOcorrenciaPolicial)
unmarshaller.unmarshal(new File(XML_DIR + id + ".xml"));
String hist = bo.getHIST();

Things didn't go as smoothly as I'd hope. This is the error I got:

java.lang.IllegalAccessError: Class 
com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection can not 
access a member of class br.sids.brh.jaxb.BoOcorrenciaPolicial with modifiers 
"protected" 
com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection.set(Accessor.java:204)

I noticed that "protected" modifiers seemed to be bothering tomcat. So
I thought I'd edit br/sids/brh/jaxb/BoOcorrenciaPolicial.java and
change all the occurences to "public". That seems to have done it. Even
<%= hist %> worked as expected. I was pleased, but I didn't like the
solution.

That file is automatically generated, it seems rather bad to me to edit
a automatically generated file like that. I'd have to notice any future
user that he has to do that (or call some script I could make) and
overall it doesn't seems really elegant to simple change protected to
public, whoever made the program probably had a reason to keep those
methods protected. Does anyone have a better solution? Maybe some
further tomcat configuration, the user of a different loader, perhaps.

-
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]