Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.

Share tech news, updates, or what's on your mind.

Sign up to Post

Dear,
What driver to choose below, when creating Database connection, to connect to SQL server DB?
18r.png
0
Free Tool: SSL Checker
LVL 10
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi,
How to resolve this?

18c.png
0
hi,
 let us say i give some random number like 81349 on console i should see output as by ascending order of each digit in each line how to achieve that as well

     1
    3 3
   4 4 4
 8 8 8 8
9 9 9 9 9

how to to achive this
please advise
0
public class MainClassIndefiniteLoop {
  public static void main(String[] args) {

    OuterLoop: for (int i = 2;; i++) {
      for (int j = 2; j < i; j++) {
        if (i % j == 0) {
          continue OuterLoop;
        }
      }

      System.out.println(i);
      if (i == 107) {
        break;
      }
    }
  }
}

Open in new window


above code gave below output

2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
101
103
107



i wonder why output shows haphazard

2
3
5
7


did not understood the logic. why 3 came after2 then 5 then 7 etc. please advise
0
public class MainClass {
	public static void main(String[] args) {
		int count = 50;

		for (int j = 1; j < count; j++) {
			if (count % j != 0) {
				System.out.println("i is"+j);
				System.out.println("Breaking!!");
				break;
			}
		}
	}
}

Open in new window


above code produced below output

i is3
Breaking!!



how to obtain same above output without break statement. please advise if there is any other alternate way of doing this?
0
public class Main {

	public static void main(String[] args) {
		int i = 0;
		switch (i) {
		case 0:
			int j = 1;
			switch (j) {
			case 0:
				System.out.println("i is 0, j is 0");
				break;
			case 1:
				System.out.println("i is 0, j is 1");
				break;
			default:
				System.out.println("nested default case!!");
			}
			break;
		default:
			System.out.println("No matching case found!!");
		}
	}
}

Open in new window

why above code produced below output

i is 0, j is 1


i is zero here right
so it should go to below case

switch (i) {
            case 0:


then all of sudden how it picked case 1 systtem.out.println as below

case 1:
                        System.out.println("i is 0, j is 1");
                        break;



please advise
0
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

	public static void main(String[] args) {

		for (int i = 1; i <= 10; i++) {
			for (int j = 1; j <= 5; j++) {
			System.out.print(j);
			}
			System.out.println();
			}
	}
}

Open in new window


what is difference between above and below code
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

	public static void main(String[] args) {

		for (int i = 1; i <= 10; i++) {
			for (int j = 1; i <= 5; j++) {
			System.out.print(j);
			}
			System.out.println();
			}
	}
}

Open in new window


both cases not getting any output but console seems running some empty lines continuously.
please advise
0
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

	public static void main(String[] args) {
		for (int i = 1; i <= 3; i++) {
			for (int j = 1; j <= 2; j++) {
			System.out.print("six");
			}
			}
			

}
}

Open in new window


what is difference between above and below program


package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

	public static void main(String[] args) {
		for (int i = 1; i <= 3; i++) {
			for (int j = 1; j <= 2; j++) {
			System.out.println("six");
			}
			}
			

}
}

Open in new window


both cases i am getting same output as
six
six
six
six
six
six


when i run inside main class
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

      public static void main(String[] args) {
            for (int i = 1; i <= 3; i++) {
                  for (int j = 1; j <= 2; j++) {
                  System.out.print("six");
                  }
                  }
                  

}
}

please advise
0
how to fix XSS and csrf issues?
1
Hi,
I have projhejct with name restweb which i imported as maven project

i hen imported another project with restweb with enhanced code in it by renaming at the named template section to xyz as attached.
when i try to start tomcat server within eclipse server wont start?
what is the work around so that i can start both projects at the same time even in future 10 more projects with same name with enhnaced code.
please advise
if not named template is there better approach to get these enhanced code projects and import to eclipse.
0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I want to find an object by multiple properties in  JPA CrudRepository ?

There is no method like  findByMultipleProperty(String property1 , String property2 , String property3)

What is the correct signature of the method for this purpose ?
0
Hi,
I want to write a code to transfer amount from one account to another.
A table will store the amount corresponding to each.

Suppose this how i transfer amount of 10  from account named A to account B

boolean amountToAdd(changeBy, accountName ) {
I run the following query using jdbctemplate with autocommit = 0
update account
set amount = amount +changeBy
where name = accountName
}

Now in my java code i will have the above mentioned transaction like :

Boolean isdeducted = amountToAdd(-10, A);
 Boolean isAdded = amountToAdd(10, B);

if(isdeducted && isAdded) {
    perform commit on transaction;
} else {
    perform rollback;
}
The issue comes in case of multithreading.
Suppose two such transactions are in process.

transfer 10 from A to B and transfer 10 from B to A

suppose amount in A = 100 and B = 90 to begin with
T1
A = A - 10  = 90
T2
B = B-10 = 80

Now as T1 has locked table A and T2 has locked Table B what will happen in this case ??

Also there is a possibility the T1 and T2 are getting executed over the same connection to the mysql server.
Then there could be the case like :

T1
A = A- 10 = 90
T2
B = B-10 = 80
A = A+ 10 = 100 (the changes will be visible as we are on the same connection)
commit;
so now A = 100 and B = 80
But suppose now there is a failure in db or something due to which T1 couldnt proceed
Then what will the value of A will it remain 100 or will it be rollbacked to what it was before T1 began...
0
HI,
I have a spring web application and its deployed on a linux box remotely. The logs are getting created there.
But everytime i have to see the logs i need to login to that machine and search for all Exceptions.
An alternative would be whenever there is any exception the exception with the stack trace could be mailed to me.
This would require changes in my java code.

Other way could be i just parse the log files everyday and mail all the exceptions with stacktrace.
For this one could make a shell script.

Please suggest any other ways i could achieve the same any better ways.
probably somewhere where anyone could see the exceptions.

Thanks
0
I would like to generate  JAXB pojos  from MySQL ER diagram ?

How to do it ?

Thanks
0
Hi,

Can u help me out with an example to differentiate between http post and put method and scenario where we should prefer put method over post?
0
Hi,

As per this link last step
https://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/
i tried detail formatter
I am getting below error

Detail formatter error:
            Unable to resolve type binding for: clientID

please advise on how to fix it.
how to use ToStringBuilder multi line style as well to see deep into Person etc object?
0
hi,

In my eclipse i have 2 projects say project1, project2......., project20

I want to get latest code for each project then do maven update then maven clean then maven install for each individually and separately.
Is there is a way or short cut where i can do all together in one step.
what is maven update? is that supposed to run after maven clean and maven install or before.

please advise
0
While hitting ewbserive using chrome advanced rest client getting eror as below for post and put request if i do not select "application/xml" from drop down.

unsupported media type error

i wonder why i ahve to select that value as
"application/xml"

delete also not working
insgtead of giving 200 OK giving 204 no content even though it seems deleting successfully

please advise
RestAPI.png
RestAPI2.png
RestAPI3.png
delete126.png
delete126_2.png
delete126_3.png
delete126_4.png
0
While hitting a get request on rest wadl using advanced rest client getting 401 error.

How to resolve it.

how to change to basic authentication where i can ignore the username and password part as that wadl do not need any creadentials

please advise
0
Concerto's Cloud Advisory Services
LVL 4
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

while doing maven clean and then maven insall i am getting below error while doing maven install





COMPILATION ERROR :
[INFO] -------------------------------------------------------------
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------






[INFO] BUILD FAILURE



how to fix this error.

what is root cause of this.
why not eclipse always remember my jdk?
do i ned to set up separately and tell eclipse about my jdk1.8??

please advise
0
while importing unzipped code as import as maven project to eclipse getting below error



Project testproject already exists


 Add a version or custom suffix using "Name template" in "Advanced" settings



how to fix this error. pLEase advise
0
I need to send a POST request using java. The server i am trying to access has a username and password i need to pass those parameters as well.

1.) I have installed Tomcat in my machine and configured the developer environment. I am using eclipse. There are different types of projects i could create using Eclipse, and i need to know what is the best project i should create to develop my application ?

2.) Can someone show me some sample code or tutorial which would help me to develop my task ?

My Eclipse version : Eclipse Java EE, Indigo service release 2

EDIT

Is it a JPA project, Enterprise Application Project, Dynamic Web Project, Dynamic Web Application, EJB project, Application Client project, Static Web Project.
1
Below line gives error as below as        device.getInternetConnection() return enum not String.            
callableStatement.setString("InternetConnection", device.getInternetConnection());


Multiple markers at this line
      - The method getInternetConnection() is undefined for the type Device
      - The method setString(String, String) in the type CallableStatement is not applicable for the arguments (String,
       Device.getInternetConnection)


Here  device.getInternetConnection()); returns the enum  InternetConnection

      public enum InternetConnection{
            
            WIFI("08"),
            CELLULAR("06");
            
            InternetConnection(String ip){
                  this.ip = ip;
            }
            
            private final String ip;
            
            public static InternetConnection getFromIP(String ip) {
                  for(InternetConnection pc : InternetConnection.values()) {
                  if(pc.getIP().equals(ip))...
                       ......
                  }
                  throw new IllegalArgumentException("This iP: " + iP + " does not exist");
            }
            
            public String getIP() {
                  return ip;
            }
      }

How to change my callable statement setter to accommodate enum instead of string?
please advise
0
Hi,

while creating client from wsdl using web servicesw getting below error




public class CustomerOrdersWS {

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            CustomerOrdersService service=new CustomerOrdersService(new URL{"http://localhost:8080/wsdlfirstws/services/customerOrders?wsdl"});
            

      }

}




Multiple markers at this line
      - Type mismatch: cannot convert from String[] to
       CustomerOrdersService
      - Syntax error on token(s), misplaced construct(s)
      - Syntax error on token ")", delete this token

i wonder what it mean by above error and how to resolve it please advise
0
Hi,

I have  abc.zip which i unzipped and imported to eclipse as maven project.

Later i got updated version of abc2.zip. I extracted to differnt folder called new_folder. Now when i try to import abc2.zip i am getting error as

 Project wsdlfirstws already exists
 Add a version or custom suffix using "Name template" in "Advanced" settings



how to fix this error and import updated abc2 project
0

Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.