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

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

Recent posts by Amit K Srivastava

Hi,

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.

Thanks,
Amit
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.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
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;
import javax.net.ssl.HttpsURLConnection;

@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 = rs.next();
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 (rs1.next()) {
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://202.164.41.156:3306/");
//DriverManager.deregisterDriver(mySqlDriver);

} 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.

//
Hi,
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 com.velos.eres.business.reviewboard.impl.ReviewBoardBean.reviewboardAccId

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 "ReviewBoardJB.java" 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.

Thanks,
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
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/opt/jdk1.6.0_30/bin

export PATH
unset USERNAME

Question: When i am compiling like " javac Hello.java " .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:\>javac Hello.java

I:\>java Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
Caused by: java.lang.ClassNotFoundException: Hello
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: Hello. Program will exit.
7 years ago