tags:

views:

138

answers:

1

Hii..

I am developing an applicaton in java which needs to integrate some php files under tomcat server. I did everything successful, but the problem is that when i shutdown tomcat server it shows some error like

Exception in thread "JavaBridgeSessionTimer" java.lang.NullPointerException at php.java.bridge.SessionFactory$SessionTimer.run(SessionFactory.java:157) at java.lang.Thread.run(Thread.java:619)

Later if i start again i could not access any of the session variables from php files. I tried a simple php program which run within tomcat. This problem will get resolved once i restart the machine, but i don't want to do this frequently for any change in any configuration files in tomcat. Please help me.

session1.php

session2.php

A: 

PHP session variables are held in memory. That means they are lost if you shut down the server.

If you need them to persist regardless of server restarts, you'll need to store them in a database or similar.

Dan McGrath
But I am creating the session from start once again, why it is not storing in memory as a new session variable?
Umaimath
You need to give more details, such as sample code that demonstrates the problem.
Dan McGrath
I have created a folder sess under weapp and put files belowsession1.php<?phpsession_start();?><html><body><form action="session2.php" method="post"> <?php $_SESSION['name']="MyName"; ?><input type="submit" value="Submit"></body></html>session2.php<?phpsession_start();?><html><body><form action="session3.php" method="post"><h2><?php echo "Session =".( $_SESSION['name'] ); ?> </h2> <input type="submit" value="Submit"></form></body></html>session3.php<?phpsession_start();echo $_SESSION['name'];?>works fine first startup.but once restart tomcat it won't
Umaimath
Sorry the code is not coming properly, there are three php files above, session1.php , session2.php,session3.php Code is not showing if i post it as a new question.
Umaimath
Sir, I have solved the problem. There was a permission denied error in log file, when i started tomcat form root the problem get resolved.Upon restart tomcat is running from init.d means from root, that was why i could run the program. I can resolve the permission issue.
Umaimath