Re: Need Help!

2015-01-28 Thread Leon Rosenberg
On Wed, Jan 28, 2015 at 8:48 PM, David kerber dcker...@verizon.net wrote:

 On 1/28/2015 2:03 PM, Hyder Hashmi wrote:

 Hi,

 I am working on a small project and need your help in this.

 I have a java program in which I read and write in a file that is located
 in the current folder.

 Now I have written a few servlets and trying to use the previous code
 along with servlets.

 Tomcat is searching for the file in its bin folder and giving
 FileNotFoundException.


 To Tomcat, the /bin folder is it's current directory.


Not quite right, the directory you started from is your current directory.
Which can be TOMCAT_HOME or TOMCAT_HOME/bin etc.

Leon





 If I use my java code without the servlet it is checking for the file in
 current folder (which is my requirment).


 It looks like you need to refactor your code to allow you to specify where
 to find the file when you call the method that does the work. Then the
 servlet and your pure java code can both specify as needed.  Of course, a
 servlet may not have permissions to anything outside of its own hierarchy,
 but that's a separate issue.




 I want to ensure that when I use my java code along with servlets, it
 should read and write in the file from current folder(Project folder in
 tomcat's webapps).

 I am not using any IDE, the  code is written in Notepad and being
 executed from CommandLine.

 I have spent long time on Internet to find the resolution but in vain.

 Request to help me with this situation .

 Hoping for a positive reply.

 Thanks for in advance for all the help.

 Regards,
 Hyder.


 -
 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: AJP connector address vs. IPv4/6

2015-01-28 Thread Wang, Andy
On Fri, 2015-01-23 at 16:05 -0500, Christopher Schultz wrote:

  
  If only one address per Connector can be specified, can you not
  just use 2 Connectors, one for each ? They should not conflict.
 
 That should definitely work (address=127.0.0.1 and address=::) but
 one connector might be nice.
 
 Maybe Tomcat could detect some magic value that is invalid for an
 address (like loopback) and then use
 InetAddress.getLoopbackAddress() instead of a traditional address
 lookup/resolution.
 

Just thought I'd provided a bit more details for completeness sake.

Even InetAddress.getLoopbackAddress isn't perfect.  What Jess left out
of his original description is that we really ideally wanted to simply
leave mod_jk configured to use localhost instead of an IP address.  We
incorrectly assumed localhost = 127.0.0.1.  I forgot that localhost can
also resolve to ::1 (for some reason I had it in my head that localhost6
would be used for ::1)

So really, without using an IP address on both mod_jk and tomcat side,
there's no good way to synchronize the two configurations.

It appears a proper getAddrInfo implementation uses RFC 6724 to declare
preference which means it prefers ipv6 addresses.

Java however by default for backward compatibility prefers ipv4:
http://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/#ipv6-related

So localhost to apache+mod_jk on a ipv4/ipv6 system = ::1
and localhost (or InetAddress.getLoopbackAddress) on a Java VM by
default is 127.0.0.1.  

Without either tweaking gai.conf (on Linux, who knows what it is on the
other unix platforms) or setting -Djava.net.preferIPv6Addresses=true on
java, native code and java code unfortunately will have differing
opinions on what ip address is localhost/loopback.

The two connectors idea is an interesting one, but that has the
unfortunate aspect of now maintaining 2 separate thread pools
complicating performance tuning a little bit especially if you can't
predict exactly which connector the mod_jk side might be using if we
rely on an ambiguous localhost value.

Be nice if Java simply implemented RFC 6724 properly.

Andy



RE: Need Help!

2015-01-28 Thread Caldarale, Charles R
 From: Tim Watts [mailto:t...@cliftonfarm.org] 
 Subject: Re: Need Help!

 It sounds like you're trying to force your notion of what a web app's
 current folder should be onto Tomcat.

Code that depends on the current directory setting is naïve at best.

 The Servlet Spec makes no guarantee as to what the current folder is 
 (a file system notion) in a Servlet container or web app.

Actually, the servlet spec doesn't even require that there _is_ a file system 
accessible to servlet code, other than the work area provided by the spec 
interfaces.  Assuming that there is one goes well outside the bounds of the 
spec.
 
 Suggest you modify your file processing class to accept a hint as to the
 current folder and set that value in the servlet using
 ServletContext.getRealPath(/) and/or via an init parameter or via
 injection.  But note that if the web app is deployed as an unexploded
 war file getRealPath() may return null.

It's perfectly legitimate for a servlet container to _always_ return null for 
getRealPath(), so depending on that is like standing on a house of cards.  Much 
better to provide the absolute path to the directory of interest via a system 
or context property.  And, as noted elsewhere, the webapp deployment directory 
(if it exists) should always be treated as read-only.

 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: AJP connector address vs. IPv4/6

2015-01-28 Thread Caldarale, Charles R
 From: Wang, Andy [mailto:aw...@ptc.com] 
 Subject: Re: AJP connector address vs. IPv4/6

 The two connectors idea is an interesting one, but that has the
 unfortunate aspect of now maintaining 2 separate thread pools

Not true - use an Executor: 
http://tomcat.apache.org/tomcat-8.0-doc/config/executor.html

 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Need Help!

2015-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Leon,

On 1/28/15 3:16 PM, Leon Rosenberg wrote:
 On Wed, Jan 28, 2015 at 8:48 PM, David kerber
 dcker...@verizon.net wrote:
 
 On 1/28/2015 2:03 PM, Hyder Hashmi wrote:
 
 Hi,
 
 I am working on a small project and need your help in this.
 
 I have a java program in which I read and write in a file that
 is located in the current folder.
 
 Now I have written a few servlets and trying to use the
 previous code along with servlets.
 
 Tomcat is searching for the file in its bin folder and giving 
 FileNotFoundException.
 
 
 To Tomcat, the /bin folder is it's current directory.
 
 
 Not quite right, the directory you started from is your current
 directory. Which can be TOMCAT_HOME or TOMCAT_HOME/bin etc.

While true, in the OP's case, the cwd actually *is* the bin/ directory.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUyWhYAAoJEBzwKT+lPKRYSNcQAJUbq/kUfk3qJq1y9lRrh4v4
QRoIxzGfxHeTIxhYKi6Wpbb7/LHv2i8Ueh7fmW56yXIYcWqJuddoVEaa7+MNdNzb
BE8K+yOKax2KiKQR8RGSydl5XqeKltI+1oPyYsRj8HIWVdBuL1IN4jxe7E5WR11V
j7GLfBo3uHdAJ+2iuBYGyZl3XhqFd1yJeHIwqLhg4pxHIA3TSzDDHJMrKCfLHBDe
6XfSNAvCdrOP3Ae5Mnid8P5MzVKiWguPKqOXhjslXK3+b2M3meSmqyPHzirWd2a8
E5uUNHntAoAn9IqajcvGkd9eq6vizCv34ByyOvW6u/3weMxxhJrvI0ZDZYG7z90X
Lq5J46/Nu4rZYnbk+ZE2DMunadZRtI89js92Wg2OTJBpL39hbnMkah0HL4HMDAQ1
ynWwsaMiUidNY8+JXA+b6KQxgHnHGCqjxRqH55KO1PI7bTc3Ymj6NuUcz/uBvfqp
QtIVd/LGJhQqD+neEOMLHz1uE1v/0DXuRhUCxEf9Alu+FxpS+MNJ5Rf9O7q45qpK
dHKBna/xGvlGaYWwBE7pZxmz64DK+PmCeNelpgsKmfEDC8VWncPnEXlrDNcsQje0
SAUAYB5nH8yyVzd2MVNcZDZBhmXK6Mum4C+C/7pLPqoy3RRZqv4BATrfPRXfUjn7
B+MrupgLXaepeRdKtzJn
=vAqr
-END PGP SIGNATURE-

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



FIPS Mode enabling on Tomcat 7.00.057

2015-01-28 Thread Geett Chanddra Singha
*Hi all,*

I'm getting the following error when enabling FIPS mode on Apache Tomcat:


Jan 28, 2015 5:02:33 PM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent

SEVERE: Failed to initialize the SSLEngine.

java.lang.Exception: error:2D06C06E:FIPS routines:FIPS_mode_set:fingerprint
does not match

at org.apache.tomcat.jni.SSL.fipsModeSet(Native Method)

at
org.apache.catalina.core.AprLifecycleListener.initializeSSL(AprLifecycleListener.java:329)

at
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:137)

at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:99)

at org.apache.catalina.startup.Catalina.load(Catalina.java:638)

at org.apache.catalina.startup.Catalina.load(Catalina.java:663)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)


Jan 28, 2015 5:02:33 PM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent

SEVERE: Failed to enter FIPS mode

java.lang.Error: Failed to enter FIPS mode

at
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:146)

at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:99)

at org.apache.catalina.startup.Catalina.load(Catalina.java:638)

at org.apache.catalina.startup.Catalina.load(Catalina.java:663)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)

*Steps I followed to configure: *



Added the following in server.xml


Server port=8006 shutdown=SHUTDOWN


  !-- Comment these entries out to disable JMX MBeans support used for the

   administration web application --

  Listener className=org.apache.catalina.core.AprLifecycleListener
SSLEngine=on FIPSMode=on/
--

1.)Installing tomcat apr:

Download from http://apache.mirror.anlx.net/apr/apr-1.5.1.tar.gz

tar zxvf apr-1.5.1.tar.gz

rm apr-1.5.1.tar.gz

cd apr-1.5.1 *

sudo ./configure

sudo make

sudo make install

export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'​

2.)Installing tomcat tomcat-native:

Download

http://apache.bytenet.in/tomcat/tomcat-connectors/native/1.1.32/source/tomcat-native-1.1.32-src.tar.gz

tar zxvf tomcat-native-1.1.32-src.tar.gz

rm tomcat-native-1.1.32-src.tar.gz

cd tomcat-native-1.1.32-src/jni/native

JAVA_HOME=/usr/lib/jvm/JAVA_HOME

sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME

sudo make

sudo make install



3.)Adding the following line

  CATALINA_OPTS=$CATALINA_OPTS
-Djava.library.path=/usr/local/apr/lib

4.) Restarting Tomcat

Pl

PlPlease help me resolve this issue and please let me know if i missed any
step.


Regards,

Geet Chandra Singha


Tomcat 7.0.57 + CXF message truncated

2015-01-28 Thread Jose Monreal
Hi guys!

I'm currently working on moving an app from JBoss-7.1.1 Final to Tomcat
7.0.57 under CentOS 6.6.
I have been able to do it without many problems, but I'm experiencing a
behaviour that's different when using the following option in the JVM,

com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true

which is the messages are getting truncated.

Is there an option on the JVM that I could add to fix this problem? Or do I
have to make a change on the app? What should I do?

Best regards,
José


Need Help!

2015-01-28 Thread Hyder Hashmi
Hi,

I am working on a small project and need your help in this.

I have a java program in which I read and write in a file that is located in 
the current folder.

Now I have written a few servlets and trying to use the previous code along 
with servlets.

Tomcat is searching for the file in its bin folder and giving 
FileNotFoundException. 

If I use my java code without the servlet it is checking for the file in 
current folder (which is my requirment).

I want to ensure that when I use my java code along with servlets, it should 
read and write in the file from current folder(Project folder in tomcat's 
webapps).

I am not using any IDE, the  code is written in Notepad and being executed from 
CommandLine.

I have spent long time on Internet to find the resolution but in vain.

Request to help me with this situation .

Hoping for a positive reply.

Thanks for in advance for all the help.

Regards,
Hyder.


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



Re: Need Help!

2015-01-28 Thread David kerber

On 1/28/2015 2:03 PM, Hyder Hashmi wrote:

Hi,

I am working on a small project and need your help in this.

I have a java program in which I read and write in a file that is located in 
the current folder.

Now I have written a few servlets and trying to use the previous code along 
with servlets.

Tomcat is searching for the file in its bin folder and giving 
FileNotFoundException.


To Tomcat, the /bin folder is it's current directory.



If I use my java code without the servlet it is checking for the file in 
current folder (which is my requirment).


It looks like you need to refactor your code to allow you to specify 
where to find the file when you call the method that does the work. 
Then the servlet and your pure java code can both specify as needed.  Of 
course, a servlet may not have permissions to anything outside of its 
own hierarchy, but that's a separate issue.





I want to ensure that when I use my java code along with servlets, it should 
read and write in the file from current folder(Project folder in tomcat's 
webapps).

I am not using any IDE, the  code is written in Notepad and being executed from 
CommandLine.

I have spent long time on Internet to find the resolution but in vain.

Request to help me with this situation .

Hoping for a positive reply.

Thanks for in advance for all the help.

Regards,
Hyder.


-
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: Need Help!

2015-01-28 Thread Mark Eggers
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 1/28/2015 11:48 AM, David kerber wrote:
 On 1/28/2015 2:03 PM, Hyder Hashmi wrote:
 Hi,
 
 I am working on a small project and need your help in this.
 
 I have a java program in which I read and write in a file that is
 located in the current folder.
 
 Now I have written a few servlets and trying to use the previous 
 code along with servlets.
 
 Tomcat is searching for the file in its bin folder and giving 
 FileNotFoundException.
 
 To Tomcat, the /bin folder is it's current directory.
 
 
 If I use my java code without the servlet it is checking for the 
 file in current folder (which is my requirment).
 
 It looks like you need to refactor your code to allow you to 
 specify where to find the file when you call the method that does 
 the work. Then the servlet and your pure java code can both
 specify as needed.  Of course, a servlet may not have permissions
 to anything outside of its own hierarchy, but that's a separate 
 issue.
 
 
 
 I want to ensure that when I use my java code along with 
 servlets, it should read and write in the file from current 
 folder(Project folder in tomcat's webapps).
 
 I am not using any IDE, the  code is written in Notepad and being
 executed from CommandLine.
 
 I have spent long time on Internet to find the resolution but in 
 vain.
 
 Request to help me with this situation .
 
 Hoping for a positive reply.
 
 Thanks for in advance for all the help.
 
 Regards, Hyder.

Hyder,

In general, this is pretty unpleasant to do which is why you're having
a tough time finding out how to do it.

1. What happens if the WAR file is not exploded?
2. What happens if Tomcat does not have write access to where the web
   application is deployed?

- -- many other unpleasant questions --

If you must do this, read the javadoc for ServletContext, in
particular the getRealPath method.


. . . just my two cents
/mde/
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBAgAGBQJUyUFzAAoJEEFGbsYNeTwt1Q8H/RINjaxS6a/jIuhbleGIjTW0
hMlGwnWayzcSxVjWwdZoEc5mIvyReIMrt4j+d6vRrSCp8+Dae6hHSZGL7h8rCCDE
slsmolNruiMP3EMmJLE5fsxginUczZwcRLihjjIrYhlZcsSmVEZEX/MFaBuT+zCO
wjftBs0rkZ/h+5g1sl79YC5SiCT2zAA3T1YTzIzajGMEtBNixTd131WC0beRuPQh
UgIYAjQwXOfqu9f+SU96Bh5V2avhzQ06J+K7HI9TgckIGymxL7NCeTkTx1fpR0bd
9lWik6RIPDV0UT76eXIF1I8d/8qu7kHMt43LnLuUflTeRO8qxZYXP2H/p2onDRc=
=78++
-END PGP SIGNATURE-

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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



Re: Need Help!

2015-01-28 Thread Tim Watts
On Thu, 2015-01-29 at 00:33 +0530, Hyder Hashmi wrote:
 Hi,
 
 I am working on a small project and need your help in this.
 
 I have a java program in which I read and write in a file that is
 located in the current folder.
 
 Now I have written a few servlets and trying to use the previous code
 along with servlets.
 
 Tomcat is searching for the file in its bin folder and giving
 FileNotFoundException. 
 
 If I use my java code without the servlet it is checking for the file
 in current folder (which is my requirment).
 
 I want to ensure that when I use my java code along with servlets, it
 should read and write in the file from current folder(Project folder
 in tomcat's webapps).

It sounds like you're trying to force your notion of what a web app's
current folder should be onto Tomcat.  It simply doesn't work that
way.  The Servlet Spec makes no guarantee as to what the current
folder is (a file system notion) in a Servlet container or web app.

Suggest you modify your file processing class to accept a hint as to the
current folder and set that value in the servlet using
ServletContext.getRealPath(/) and/or via an init parameter or via
injection.  But note that if the web app is deployed as an unexploded
war file getRealPath() may return null.

--- Tim

 I am not using any IDE, the  code is written in Notepad and being
 executed from CommandLine.
 
 I have spent long time on Internet to find the resolution but in vain.
 
 Request to help me with this situation .
 
 Hoping for a positive reply.
 
 Thanks for in advance for all the help.
 
 Regards,
 Hyder.
 
 
 -
 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