PHP process (started by the PHP-Java bridge) getting terminated unexpectedly - java

I have an application running in Tomcat 6.0.36. There was a requirement to implement CMS (content management) in our application. For this, a third party vendor is signed up to provide the static content. The CMS pages are written in PHP and hence it became necessary for us to render the PHP content using tomcat server.
To achieve this, I downloaded the “JavaBridgeTemplate621.war” (from http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1/JavaBridgeTemplate621.war/download) and deployed it in the webapps folder. Later I renamed the exploded folder and renamed it to ‘cms’ (deleted the JavaBridgeTemplate621.war file this time). The PHP files placed in this ‘webapps/cms’ folder is rendered properly by the tomcat server. This was the exact requirement.
While starting the tomcat server, the PHP-Java bridge also created a few Java processes. On the LIVE environment, these processes were killed 3-4 days after the deployment(restart) happened.
The error in the catalina log is,
PHP application terminated unexpectedly, have you started php-cgi with the environment setting PHP_FCGI_MAX_REQUESTS=5000? Error: php.java.bridge.http.FCGIConnectionException
php.java.bridge.http.FCGIConnectionException
at php.java.bridge.http.FCGIConnectionOutputStream.flush(FCGIConnectionOutputStream.java:87)
at php.java.bridge.http.FCGIConnectionOutputStream.close(FCGIConnectionOutputStream.java:71)
at php.java.servlet.fastcgi.FastCGIServlet.parseBody(FastCGIServlet.java:357)
Can someone help me understand the root cause of this issue?
The ‘memory_limit’ variable is seen to have the value 64M. Is it too low a value ? If so, what would be an ideal value that needs to be set ?
How will the setting ‘expose_php=off’ affect ?

Related

Vanilla Openshift v3 tomcat log

I installed a java EE application on Openshift V3 (migrated from v2 to v3 recently)
I have a running java pod and all the function seems to work fine over web.
Almost all the openshift settings are default
All my work is on image:
jws30-tomcat8-basic-s2i
My biggest trouble right now is, I am not able to determine the location of all stdout from my java application deployed on server (I dont have any personal logger, I am just doing System.out.println at various places... I know poor me)
I went on to check "logs" directory in the pod-terminal and no files were present there.
I was wondering where is this file (containing all std outs) getting generated ?
(I understand if somebody would need more information like some env. variable or something, let me know I will get it...altho like I said 'vanilla openshift v3 tomcat').
There are two places for you to check the standard logs. On the command line:
oc logs PODID
On the web console you can view the logs as well for a pod by looking at the pod detail. If you want a collated view of all logs for all pods (and aggregated logging is enabled for the cluster), click on the archive link when viewing a pods logs.

Tomcat: cannot upload a file correctly 2 times

We develop an application which uploads some CSV file.
In order to be sure about our code, the upload has been tested with 2 differents framework : ZK (which manages upload itself) and with classic jsp/Spring REST.
On our local server (windows, tomcat 5.5) all is ok.
On client system (Unix Solaris 10, tomcat 5.5) we have a pb : the first time the file is correctly uploaded, the second time if we change something in data (even if we delete the file) we have the same file as first upload....
It seems a cache or something else disturb the upload.
Any idea ?
Thank you.
[Edit] Additional information
For information, we are on Citrix Metaframe Program Neighborhood (a old version -> v9.0).
For those present at the customer (with or without Citrix), CSV file are uploaded correctly each time.
For us, who are outside, that's not working.
File A is uploaded, then we modified it (A') then uploaded again...and the result is : file A is deleted (as expected, by programmation) then a new file appear which is the same as A (not A' as expected).
If we stop Tomcat or even make others http request, the upload works correctly.
We test upload with 2 differents framework : ZK (which manage the upload itself) and Spring MVC (REST). Both are working on our servers with same Tomcat (5.5).
Other thing strange, we have access to an another server (by VPN not Citrix) where we deployed the application on a Tomcat 7 (already installed by the client). All is OK.
Is it possible that is an hardware problem? with a router...
First of all, it is very difficult to understand your question. With what I understood, you are not able to load any file the second time as the details of the first file are still present in memory/variables. Post your code so that it will be easy.
Try these
Start the application, load a file, say A.csv, first time, then stop
the application
Start the application again, and load another file B.csv and see if it is loaded correctly.
If steps 1 and 2 work correctly, you can be sure that no one has hard-coded anything in the code.
Now, go through your code and see if you have any static variables, being set with the contents of the file.
If removing static variables doesn't work, try printing all the variables and narrow down the issue.
Good luck!

Precompiled JSP and Servlets on a Weblogic server (UNIX)

We have a web application hosted on this webLogic server on a UNIX machine. Its primarily a JSP/Servlet based app. Whenever we do a modification/enhancemment to any one of those JSps or servlets, I precompile them on my local and deploy them on the UNIX system. For example, if there is a file called GetIdServlet.class, we usually rename the existing file to say GetIdServlet.class1 and then put in the new file as GetIdServlet.class. This is just to be able to revert back to the original file in case they are needed. However, I notice very strange behaviour. The application loses some functionality whenever we stop and start the server. The functionality may be back on the next or a few restarts after that. For example, a submit button that is supposed to direct it to the next page just stops working. It may start working after a few restart.
However on my local(Eclipse + webLogic) there is absolutely no issue. Everything works fine. Any ideas on what's going wrong?
You are using Unix Environment and i assume that the local desk setup used is windows OS or MAC. thus, when you copy the class files you are using some tool like WinSCP.
in case so, then please set the copy settings of such tool to use binary method of copying the files.
Example in WinSCP. go to Options->Preferences->Select Transfer in the Side Menu->under the Transfer Mode section, Select Binary option as the Transfer Mode. This will ensure that the binary replica is created on the Unix environment and that no data is lost in the transfer.

Recommended server for JNLP

I have never used JNLP, and I have no web/war server already running so I will install it from sratch:
Which to use?
GlassFish
Tomcat
Apache
Jetty
Another?
I wonder if someone already using JNLP could make any recomendation for the server.
I just want a blank page with a button in the middle for starting the application nothing more, nothing less.
If you use only JNLP you don't need Java server. JNLP is client side. Simple http server like Apache HTTP Server should be OK. HTTP server will be better solution than use of web container/Java EE server because JNLP (usually) is a static content. Even lighthttpd should be enough.
As already stated any server capable to serve HTTP will do. If your WebStart application is not signed by itself (i.e. you code-signed the corresponding Jar files) you could probably consider to publish the JNLP plus its resources via HTTPS. This way your clients will know that the software they are going to execute came from its rightful origin. Although unsigned WebStart applications are restricted in their privileges on the client's machine it still is a measure to elicit trust in your clients. On the other hand this requires more configuration effort with regard to the server you chose.
If your application will need some extended privileges on the client's machine such as access to the file system then I would recommend that you do sign your jar files to gain the necessary privileges automatically (don't forget to specify them in a element within your JNLP).
These are the default restrictions for unsigned WebStart apps:
No access to local disk.
All your jars must be downloaded from the same host. Note, however, that you can download extensions and JREs from any host as long as they are signed and trusted.
Network connections are allowed only to host from which your jars were downloaded. ("Phone home restriction.")
No security manager can be installed.
No native libraries (not even in extensions).
Limited access to system properties. (The application has read/write access to all system properties defined in the jnlp file, as well as read-only access to the same set of properties as applets
You dont need a server to run JNLP(Webstart).. This is how webstart works
it simply is an application that can be started over the web, this would be the procedure from the user perspective:
user goes to yourwebsite.com
user see's link: run my awesome app
user clicks link, which downloads .jnlp file
user runs the jnlp file through java web start (part of java SE, user requires java runtime environment JRE to run this)
java web start reads jnlp to get information about the server that holds the corresponding application
jar files get downloaded automatically (the first time) and then the application starts
user gets bored and closes application
the next day, user comes back and clicks your link again
application is already downloaded, so it starts right away
user gets bored again and closes your application
1 day later, you decide to update your application and you deploy the new jar file on your
server, replacing one of the old files
after 2 days user clicks your link again
java web start recognizes that the user has a different version, downloads update automatically and starts the application again
...
..
.

Servlet throws file not found excp when accessing network drive

I've a production env and test env. Production has win2k3+tomcat 6.0+ and network drive mapped to a drive letter for easy access (z:\app instead of \symba\files\app). My test env has windows xp (all the software is same including the source code for servlet) and test also has the same drive letter mapping to the network drive.
Tomcat is running with the same user id in both the systems and am able to access the file via windows explorer in the test m/c and production m/c.
Now the servlet in the windows xp m/c (test m/c) throws a file not found exception if try to access an existing file (reachable via windows explorer). The servlet in production is same as in test env and production servlet happily gives the file when i request it and does not throw any error what so ever.
I've see some posts that using drive letter is not a good idea and should use UNC paths instead and i've not tried this yet. I want to know the reason why test servlet fails to get file whereas production servlet works fine.
Thank you very much for your time and help
Bo
Are you running the application server as a service? Drive letter assignments are reliable only if you use interactive programs not services.
A couple of years ago, I tried to resolve a quite identical problem but, at last, I gave up and I used JCIFS to access the files.
If you run Tomcat with a security manager, the web app code is according to the default configuration only allowed file access to its deployment directory. If you want to change the application policies, you can do that in conf/catalina.policy or you can disable the security manager, if you want your web app code to gain all privileges.
You might want to consider running the Tomcat service as the user who has access to the mapped drive.
As pointed out by andcoz, the mappings will not apply for the SYSTEM user in Windows that I presume is being utilized for running Tomcat. You could change the service configuration to run as the user owning the drive mapping and verify if the failure continues to occur.
Related:
FileNotFoundException thrown when the file does exists.

Categories