Java EE





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

Can an application use a JDBC driver that can contain the IP to both a primary and Standby instnace, so that the client can switch to standby if the primary IP is no longer reachable.

Or is there some other way an application can perform this

We are using an Oracle DB (Data Guard, primary and standby), but I am asking this from a client application failover to the correct DB instance, as opposed to a db failover
Free Tool: Site Down Detector
LVL 12
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

I'm currently using Roaster to generate a rest class, but i don't know how to implements http annotation (Get, Post,..) ?

Here's what I was trying to generate them with :

public class RestGenerator {
     public static void main(String[] args) {  

    JavaClassSource source = Roaster.create(JavaClassSource.class);
    source.addMethod().setName("Create").setPrivate().setBody("return null;")

    source.addMethod().setName("Delete").setPrivate().setBody("return null;")

output :

public class RestController

   private void Create()
      return null;

   private void Delete()
      return null;
Best Approach to validate the current action

1. Saving user details on login in the user session. For every action after login, check whether user has roles and permissions every time. DB needs to be queried since an administrator can change the privilege of the user any time. Query the roles and permissions of the current user and verify the operation every time.

2. Saving user details on login in the user session. For every action after login, check just the roles/permission associated with the session. DB doesn't needs to be queried. However if Administrator or any user changes the permission of the current user from different country invalidate the current user session which should be stored somewhere.

Which one would be the best approach on the above ?

Need sample code snippet for the above approaches and how to achieve it
When I deploy my ionic 2 application on the production server, I am getting the errors below. But when I run the application on the localhost, it runs fine.

vendor.js:1349 Uncaught SyntaxError: Unexpected token ?
main.js:1 Uncaught ReferenceError: webpackJsonp is not defined
    at main.js:1

Open in new window

hi am in oracle form 11gR2 i what to display a down arrow on top of my button how can i do that this arrow ↓ without using image
How to Write a simple application which will register a user and authenticate the user. You can use default H2 for database. Once authenticated, the user should be able to give a string to translate into the language he desires (French, German, Tamil versa. You can use Google or Microsoft Translate API.
1. What is BindingResult?
2. When to use BindingResult?
3. Assume @ControllerAdvice is used in a project to handle errors. How BindingResult can be retrieved or processed in @ControllerAdvice
4. Is BindingResult is used for only presentation validations or can be used for business validations as well ?
Spring SAML security: I need assistance to separate saml authentication with granting authorities. After authenticating against AD, I need to execute a web service call to retrieve user roles , prompt the user to select a role atnd then grant authorities to the user based on the role selected.
How do I go about achieving this?
Dear sirs,
I am setting up a global exception handler in Spring. Once an exception is caught, a method in the @ControllerAdvice is called in, and returns a specific view with exception details. Among info returned with the view, I have the HttpStatus, that can get. Actually I keep getting 200, while the right HttpStatus should be 500, 404, etc.
Here is my code
public class AppGlobalExceptionHandler {
       * Note: You can either point to Exception Types or Http ResponseStatus
       * @ExceptionHandler({MyException.class})
       * public String ...
       * @ExceptionHandler
       * @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
       * public String
       * */
      public String handleAnyException(Exception exception, Model model,
                  HttpServletRequest request, HttpServletResponse response) {
            log.error("Request raised " + exception.getClass().getSimpleName());
            String details = ExceptionUtils.getStackTrace(exception);
            AppError error = new AppError();
            model.addAttribute(AppStringHandler.VARIABLE_URL_SUBMIT, AppStringHandler.URL_TASKS_SEND_EMAIL_500);
            model.addAttribute(AppStringHandler.VARIABLE_URL_REDIRECT, AppStringHandler.URL_ADMIN_REDIRECT);
            model.addAttribute(AppStringHandler.VIEW_ERROR_MODEL_ATTRIBUTE, error);
hi am having this error when starting node manager in window
my java version is
C:\Users\rdp>java -version
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
Hire Technology Freelancers with Gigs
LVL 12
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Can we follow the below approach for Spring MVC application ??

Accessing thread local for http session...Note: Each http session request will be bind to one thread...
I am struggling with a problem on JSF Primefaces 6.0 where in I have main page which has the list of addresses and main save button. The list of addresses in displayed in data table and the user can click on the edit button to edit any row of the data table. The edit button opens a dialog popup where user can change the address attributes and the click on "OK" button which should updated the list grid data as well as updated the address object in the listgrid of the main bean.
Currently I am facing the problem where my changes in the address popup are not visible in the backing bean method.

Sample code :-

      <addresslistTable> bean:addressList
            <addressline1> value="variable.addressline1" onclick--> bean.getAddressById(

      <addressline1> value="bean.otherAddress.addressline1"  --> user can change this value
      <p:commandButton value="#{msg.common_save}" process="@this" action="#{bean.submit}" update=":main:addresslistTable" oncomplete="PF('addressDialog').hide()"/>

class bean {
Address otherAddress;

public getAddressById(addressId){
      otherAddress = getAddressFromDatabaseById(addressId);

public void submit(){
// here I am accesing the otherAddress.addressLine1 which is still showing be the old value


I write the code to print the pdf file using PrintService. but my printer has id and password. how should i set id and password in my code.

PrintService service = PrintServiceLookup.lookupDefaultPrintService();

                      System.out.println("Default printer: " + service);
                      FileInputStream in = new FileInputStream(new File("filepath"));

                      PrintRequestAttributeSet  pras = new HashPrintRequestAttributeSet();
                      pras.add(new Copies(1));

                      DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
                      Doc doc = new SimpleDoc(in, flavor, null);

                      DocPrintJob job = service.createPrintJob();
                      PrintJobWatcher pjw = new PrintJobWatcher(job);
                      job.print(doc, pras);
We are following MVC pattern - model view controller and flow is

Controller -> Service -> Dao -> JdbcTemplate -> MySQL

1. All the errors should be cached and thrown in controller layer ? (OR) Error should be thrown from the controller method and it should be handled in the front end - js or jsp files ?

2. Do we need to catch DAO exception in the service layer or just pass the thrown exception to the controller layer and let the controller handle the exception?

3. Customized exception can be thrown on DAO and in service layer. However does the final exception handling should be done in controller side or in service layer.

4. Does the controller should catch any exception and create the localized error message and just pass the error message as string and response type as error to the front end to handle the error in the front end ?

How to create a BaseDAO class for jdbcTemplate which handles the save, update and delete in generic way so that we can use the same in any entity.

for example, in sales we may have the id column as salesId, in product we have the id column as id, in inventory table we will have the id column as invId.

Assume we need to have one generic method for save which gets something like parameter names and values and inserts it

Example as

However the above example doesn't clearly says the or gives the implementation of the BaseObjectMapper and seems pretty big

Need a proper way to define the save, update and delete.
i just need to pass an array to rpg from java but its not running error free.
here is my code

import java.beans.PropertyVetoException;

public class CallingArrayPgm {
    public static void main(String[] args) throws PropertyVetoException{
            AS400 sys=new AS400("", "THARINDU", "GAYAN@123");            
                  int[] accounts = new int[5];
             AS400Array accountsarray = new AS400Array();
            ProgramParameter[] parmList1 = new ProgramParameter[1];
                ProgramParameter[] parmList2 = new ProgramParameter[1];
                parmList2[0] = new ProgramParameter(accountsarray.toBytes(accounts),5);  
             ProgramCall pgm = new ProgramCall(sys,"/QSYS.LIB/THALIB.LIB/ARRAYTEST.PGM",parmList2);
                 if (!=true) {
                    AS400Text text = new AS400Text(30);
                AS400Message[] messageList = pgm.getMessageList();
                System.out.println(messageList.length + "TEst ok");
            }catch(AS400SecurityException | ErrorCompletingRequestException | ObjectDoesNotExistException | IOException | InterruptedException e) {
I want to  filter my datatable then select row, i do this but the select return null after filter ?!

my xhtml page:
      <p:dataTable id="dt" var="s" value="#{searchBean.tvList}" emptyMessage="No Object found with this id" rowKey="#{s.tag}" >
            <f:facet name="header">SELECT FROM DATABASE</f:facet>
            <p:column headerText="TAG" filterBy="#{s.tag}" filterMatchMode="contains" style="text-align: center">
                  <h:outputText value="#{s.tag}" />
            <p:column headerText="TEXT" filterBy="#{s.text}" filterMatchMode="contains" style="text-align: center">
                  <h:outputText value="#{s.text}" />
            <p:column style="text-align: center">
             <h:commandButton value="SELECT" action="#{searchBean.printResult()}">
                <f:setPropertyActionListener value="#{s}" target="#{searchBean.selectedTV}" />

and my managebean:-

emphasized text@ViewScoped
public class SearchBean {
      private TV selectedTV;
      private List<TV> tvList;
      public TV getSelectedTV() {
            return selectedTV;

      public void setSelectedTV(TV selectedTV) {
            this.selectedTV = selectedTV;
      public List<TV> getTvList() {
            return tvList;
      public void loadData() {
            tvList = new ArrayList<TV>();
            Operations dao_pojo = new Operations();
            tvList = dao_pojo.get_all_data_TV();

      public void printResult() {
            if(selectedTV == null) …

When first time deploy war file, after the completion I made a http request for the system (example: http://localhost:9080/CSW/login/login.jsp).

Receiving the following error:
Virtual host/WebGroup not found: The web group CSW/login/login.jsp has not been defined.

Could you please help with it? Why I get this error?
Every 15 mins mail should trigger to my mailbox using java program. i have content of mail which should send in every 15 minutes to my mail box.
Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Hello, Currently I was working on Struts 1 Application and I need to know whether it is possible to integrate the current application with Spring framework. What can be suitable method to do so? Or do I need to switch my current Struts framework with Spring.
Hello dear friends. I started to study Java and want to make the program "hello", but not quite simple.
I've already learned how to write simple programs, but with more complex programs I have problems.
Therefore, I am asking for help. My question (it is highlighted) is below. First a short introduction.
Now I'm learning Java (I'm using Eclipse) and I came across the following learning example - a variation of the text-to-speech (TTS) program in Java.

The essence of the program (it contains 2 classes and 1 referenced library jl1.0.1) is as follows:

1. Link your project with JLayer library for mp3 playing from java (I used jl1.0.1.jar).

2. Create instance:
GoogleTextToSpeech gtts = new GoogleTextToSpeech()

Open in new window

3. Use:
gtts.say("Hello everybody", "en")

Open in new window

First argument is phrase to say, second is language.

I added my comments to the code and commented out unwanted line, now the program (`Main class` and `GoogleTextToSpeech class`) looks like  

I am starting the code by press `Run as → Java Application` on ``.

I have this (in Eclipse console): Server returned HTTP response code: 503 for URL: 

Open in new window

hi am having this error when trying to install my java jdk am in window 7
Dear sirs,
I would like to integrate the Bar Code functionality into a POS System. Any suggestion in terms of library, tutorials, etc.. or any advice will be highly appreciated.


I'm currently facing the following issue with a javafx-application under NetBeans IDE.

When I'm adding a specific maven dependy (bcprov158- bouncycastle provider), I can't build program anymore:

failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project

Does anyone know how to solve this?

I see the below exeception without much details. Not sure the root cause of it
      at javax.faces.webapp.FacesServlet.service(
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(
      at some.other.package.RoleRestoreFilter.doFilter(
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(
      at some.package.SecurityFilter.doFilter(
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(
      at org.apache.catalina.core.StandardWrapperValve.invoke(
      at org.apache.catalina.core.StandardContextValve.invoke(
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
      at …

Java EE





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.

Top Experts In
Java EE