Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!

Amit K Srivastava

+ Follow
since May 31, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amit K Srivastava


I am creating a soap web-service using Netbeans.
After deploying it on server , after 24 hour service get stopped and I need to redeploy this WAR file again.
What is problem , is there any way to make this application as system service so that it can rescheduled to start after 24 hours.

I am able to create a shell script that redeploy other dummy restful web-service after 24 hour.But here i am just compiling 2 java file and executing it on server.

But in first case we have many files and , I am deploying it on server as WAR.

6 years ago
Hi All,

I am using restful service to login into application.In responce i am getting "success".But if i am trying to use this response for further pages it goes always in else case . I am not able to figure it how to handle this.

6 years ago
Hi all,
I am having same problem.Application and database both are on Linux Machine .Please help

Code of java connection class is :
//Class Code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

@WebService(serviceName = "NewWebService")
public class NewWebService {

private final String USER_AGENT = "Mozilla/5.0";

@WebMethod(operationName = "isValidUser")
public String isValidUser(@WebParam(name = "phone") String phone, @WebParam(name = "pass") String upass)
String mesg = "";
Connection con=null;

try {
con = ConnectionProvider.getCon();
String query = "select * from customer where mobile_phone='" + phone + "' and password='" + upass + "'";
PreparedStatement ps = con.prepareStatement(query);
ResultSet rs = ps.executeQuery();
System.out.println("query----" + query);
boolean status =;
if (status) {
con = ConnectionProvider.getCon();
String query1 = "select verified from customer where mobile_phone='" + phone + "' ";
PreparedStatement ps1 = con.prepareStatement(query1);
ResultSet rs1 = ps1.executeQuery();
String str = "";
while ( {
str = rs1.getString(1);
if (str.equalsIgnoreCase("y")) {
mesg = "you have successfully Login";
} else if (str.equalsIgnoreCase("n")) {
mesg = "please comfirm your account first";
} else {
mesg = "UserName or Pasword Wrong";

System.out.println("status----" + status);
//java.sql.Driver mySqlDriver = DriverManager.getDriver("jdbc:mysql://");

} catch (Exception ex) {
System.out.println("Execption uis : " + ex);
return mesg;

//End class Code

//Error Log from Apache
Execption uis : com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,221,771 milliseconds ago. The last packet sent successfully to the server was 57,221,784 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

I am getting same problem .
FATAL [reviewBoard] Error in getReviewBoardDetails() in ReviewBoardAgentBeanjavax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of

In this case, i am trying to get name of all Review Board Names.When i click on records inserted by form , i am able to get those records Name , but when i am trying to get records that were inserted in table as seed data.I am getting this error?
I am using "int" in my "" file. I am not getting if this is error due to primitive data-type, then why it work with others that records inserted by form.
Please guide me how to solve this.

Amit Kumar Srivastava

Hello Sir,

I am trying to run java in RedHat 5.I have installed jdk1.6.0_30 , and set class path as follows:
1- vi ~/.bash_profile
2- Added following lines :

[root@localhost ~]# vi ~/.bash_profile

Then You Get file like this .Now Add following lines .

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc

# User specific environment and startup programs


export PATH

Question: When i am compiling like " javac " .It compile file and when " java Hello " . Then it gives some message like "main class not found...." .So i am amazed that same things are working fine at one PC , and when i am trying to run in another PC, so get this error. I am not getting where is problem ?
7 years ago
thank you so much Sir Campbell Ritchie:
It works !.
I had set Apache Tomcat Path as classpath in both user and system varaible , that was creating problem.And in future i want put any query in colors as you mentioned.
Thank You So Much.
7 years ago
Hello Sir,
When i am running this program in my system , it compile fine but on run it gives following errors .I am not able to run this file.While it successfully run in NetBeans i am using in my system.I am not getting what is reason for this.Please help me.In fact i have installed this many times but it worthless.Here i am showing console output below.This is Simple Hello World Example.


I:\>java Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
Caused by: java.lang.ClassNotFoundException: Hello
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
Could not find the main class: Hello. Program will exit.
7 years ago