Getting an error after I changed a processpath of my project properties

I am currently studying JPA, for now I am making a simple login system. Now I used this solution which instructed me to delete part of the project properties. But after I have deleted the said line of code I get this error after re-building or running my project:

Executing C:UsersLRC-01DocumentsNetBeansProjectsJPA Login Demodistrun1470478781JPA Login Demo.jar using platform C:Program FilesJavajdk1.8.0_151jre/bin/java
Error: Could not find or load main class com.login
Java Result: 1

How do I solve this problem, is this some kind of a bug? The question was dated 3 years ago so I thought this was fixed.

error in getting data from sql in parameterising sql queary

                     +"("+builder.deleteCharAt( builder.length()-1).toString()+")" ;
PreparedStatement statement = conn.prepareStatement(stmt);

Does methods takes space after serialization?

I have a class like this one:

class A{
    int a;
    int b;
    // a lot more properties...

    void methodA(){
       // very long method
    void methodB(){
       // very long method
    // a lot more methods...

At one point I need to serialize the instance of this class and send it through the net to another node. At the other node only the properties are need, the methods are not. As sending data through the net is expensive, to be light weighted should I make another intermediate class like the following one to strip all the methods and send the serialized instance of this class instead?

class A_{
    int a;
    int b;
    // copy all the properties in class A

does JVM gives memory to local reference variable with value null

I was a puzzled with memory management in java. Everywhere it is written that local variable is given memory in stack. And if that local variable is of object type, then it is given memory in heap. I want to know where does JVM allocates memory for local object reference variable with value null.

public void show(){
Animal animal = null;

where does the JVM allocates memory for animal object. Is it in stack? or it does not give any memory because it is marked null. I am sure it is not given memory in heap.

can any one clear away my doubts.

Is there anyway to assign one property to another on start up in Spring?

I have jms.username and jms.password already configured in my project. I need to import an external library into my project. Unfortunately it needs same credentials to different properties (example: ext.jms.username, ext.jms.password). Instead of redefining external properties in property file, I have decided to copy values from jms.username into ext.jms.username.
The code looks like this

class MainConfig{

    ExtServiceClient extServiceClient;

    PasswordRetriever passwordRetriever;

    public void setProperties(){
        env.setProperty("ext.jms.username", env.getProperty("jms.username"));
            env.setProperty("ext.jms.password", env.getProperty("jms.password"));
            env.setProperty("ext.jms.password", passwordRetriever.getPassword);


ExtServiceClient is from external library which needs ext.jms.username and ext.jms.password to be initialized. How to make this working?

There is one more catch here. I have a service to retrieve password, if the password from property file is empty. Updated the code.

Want to Build 2 Applications in 2 different jdk and then Run in Two Tomcat servers

I have 2 separate applications to build (using maven command) and run.

1st appl. should be built in jdk-6, while the 2nd appl. in jdk-7 and then deploy the .war file in Tomcat’s webapps folder.

I am currently changing the environment variable JAVA_HOME and PATH separately to build these two appl. everytime.
It’s a hectic and time consuming process. Is there any other alternative to build two applications simultaneously in different jdk version at the same time?

Again, I need to run both applications at the same time in my local servers, one in Tomcat-6.0.44 and other in Tomcat-7.0.47.

I did the below changes in server.xml files of these two Tomcat versions.

in 1st,

<Connector port="8080" ...>
<Server port="8005" shutdown="SHUTDOWN">
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

in 2nd,

<Connector port="8086" ...>
<Server port="8007" shutdown="SHUTDOWN">
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

But still I cannot run both the local servers at a time.
While one server is up, the other is not being up. Please suggest me an alternative on this problems.

AWS Lambda Using scala Bean classes for parsing

I am attempting to retrieve the input from an AWS Lambda function as a Bean class instead of an InputStream. I have kept my code generic and converted everything to java.util.Map[String,String]:

package hello

import java.util

import scala.beans.BeanProperty

class Request(
  @BeanProperty var body: java.util.HashMap[String,String],
  @BeanProperty var headers: java.util.HashMap[String,String],
  @BeanProperty var pathParameters: java.util.HashMap[String,String],
  @BeanProperty var queryStringParameters: java.util.HashMap[String,String]
) {

   def this() = {
    this(new util.HashMap[String,String](), new java.util.HashMap[String,String](), new java.util.HashMap[String,String](), new java.util.HashMap[String,String]())

When I check the logs on the lambda function execution:

An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class hello.Request]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: lambdainternal.util.NativeMemoryAsInputStream@7791a895; line: 1, column: 2]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class hello.Request]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: lambdainternal.util.NativeMemoryAsInputStream@7791a895; line: 1, column: 2]
    at com.fasterxml.jackson.databind.JsonMappingException.from(
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
    at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(
    at com.fasterxml.jackson.databind.ObjectReader.readValue(

How can I define a bean with the default constructor as required by jackson in order to avoid parsing the input stream manually.

How to send data using javax.json.JsonArray

I have a json array written in javax.json.JsonArray ready to be sent over the net. Usually, I’m using
org.json.JSONObject which works fine with volley.

My problem is that I do not know how to send my json array over the net.
Please HELP, how can I send this data?

Furthermore, I have a reason why I am implementing javax.json.JsonArray

JsonArray jsonParams = Json.createArrayBuilder()

                    .add("cusEmail", email)
                    .add("totalQuantity", quantity)
                    .add("totalCost", totalCost)
                    .add("phoneNumber", phoneNumber)
                    .add("address", address)
                    .add("closeShop", closeShop)
                    .add("contact", contact)
                    .add("status", "ordered")
                    .add("orderDate", dateFormat.format(orderDate))
                    .add("deliveryDate", delDate)
                    .add("orderedItems", Json.createArrayBuilder()
                                    .add("name", nameString)
                                    .add("manufacture", manufactureString)
                                    .add("price", priceDouble)
                                    //.add("image", imageString)
                                    .add("quantity", qauntityInteger)))

    Log.d("--------> ", jsonParams.toString());

    JsonObjectRequest postRequest = new JsonObjectRequest(Request.Method.POST, URL, jsonParams,
            new Response.Listener<JSONObject>() {
                public void onResponse(JSONObject response) {

                    String status = null;
                    String message = null;

                    try {
                        status = (String) response.get("status");
                        status = (String) response.get("message");
                    } catch (JSONException e) {
                    if (status.equals("success")) {

                        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();

                        Intent intent = new Intent(getApplicationContext(), Login.class);
            new Response.ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    // handle error
                    Log.d(TAG, "Error" + error + "nmessage" + error.getMessage());

The volley class does not accept javax.json.JsonArray and/or javax.json.JsonObject, so in my Android Studio I have an error with the volley class. How do I go about sending the data? Should I use volley or some HTTP connection??? Please help!!!

Object values becomes NULL while passing to the servlet in JAX-RS

JAX-RS using Jersey

I am trying to send an object “Broadcast” from the client to the servlet and print the values in the servlet side. But my output becomes null. Help me with the issue thanks in advance 🙂


public Response sendMessage(Broadcast broadcast) {
    return Response.ok().status(200).entity("SUCCESS").build();


public class Client {
public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
    Broadcast broadcast = new Broadcast("SENDER", "RECEIVER", new Timestamp(System.currentTimeMillis()));
    Response messagePost ="http://localhost:8081/xyz/abc")
            .post(Entity.entity(broadcast, MediaType.APPLICATION_JSON), Response.class);

Broadcast Model

public class Broadcast {
private String senderName;
private String receiverName;
private Timestamp time;


public void writeTo(Broadcast broadcast, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
    try {
        JAXBContext context = JAXBContext.newInstance(type);
        Marshaller marshaller = context.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");
        marshaller.marshal(broadcast, entityStream);
    } catch (JAXBException e) {