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

Hi all,

I have problem to display my PDF file in an existing popup window using spring framework. The workflow is when I click a button from the main page, it popups a new window (child) and showing progress status. After the file finished generating, I set the view in controller and return to jsp. However, the PDF file displays (using DefaultResourceLoader and response.flushBuffer) in the main page instead of the popup window. I want to show in popup. Anything wrong? How can I specify which window the PDF should be displayed?

Please help. Thanks.
Cloud Class® Course: SQL Server Core 2016
LVL 12
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

May I know how to popup pdf file in Spring framework?
Websocket or TCP or Push Notification ????

I am planning to build a mobile app to see the updates of stocks being added by the user as soon the price got updated.

1. Do we need to use Websocket or TCP or push notification in this case? Which one is better ?
2. Do we have any stock market test API's which supports Websocket or TCP or Push notification to cross check the feasibility, stability, reliability and latency ?
3. What are the differences between websocket vs TCP vs Push Notification ???

Need answers for the above three questions and the final decision as well. Please Suggest.
Need experts view on the following line  -
Most NoSQL solutions however are built with the assumption that the data does not fit on a single machine and hence have sharding builtin.

Is it that noSQL solutions have easier or better sharding capabilites than relational databased like mysql ?

And should one use noSQL always in case of sharding ?

I was going through the url shortner example on this page -
Although my query is simply about the hashing function that can be used to compute the shortened url .
Here it gives a way to encode the url -
I have few queries on the same  -
1) suppose i use a base62 hash function to shorten a url or even some other function as anyone can easily discover this then that is not desirable.
what exactly are the reasons for this. Although it does feel bit insecure that someone knows the hash function but so what. what are the pros and cons ?

2) Database ID encoded to base_62 also won't be suitable for a production environment because it will leak information about the database. For example, patterns can be learnt to compute the growth rate(new URLs added per day) and in the worst case, copy the whole database.

How is this possible because at most a user can predict the shortenedUrl thats all .
And shortened url, original url is inserted into a database.

Please help me understand why above both are true..
I am planning to build a service like shortening url for learning purpose..I was working on it theoritically.
And realized that i would be needing to store approximately 32 GB of data in the long run...
It will be mostly key value pair data  
eg -
1)  |  www.klasjlkajsf.comalskdfjlaksdjflkasjdfl
2)  | www.laksdjflkasjdflkasd.aldskjflkasdjflkasdf//alsdkfjalsdfj

So i was wondering which database will be better.
Dont know how Mysql will behave when total data reaches 32 GB ?
How long will it take to query it..
Is there some theoritical way to find it out. I think putting an index on the first column should be really fast kind of binary search ?
What are the alternatives  or best way ?
I read about redis that seems to be an in memory database so should be really fast. But it probably cannot store more data than the amount of RAM.
is redis feasible when the amount of data is so big like 32 GB ?
Do we need 32 GB of RAM or there are alternatives ??

I have deployed my code on two machines M1 and M2.
They fetch a USer Object which contains details about name, designation, emailID etc corresponding to a userId.
Currently i am storing them in cache like this :

    private Cache<String, User> userCache;
 userCache = CacheBuilder.newBuilder()
                .expireAfterWrite(60, TimeUnit.MINUTES).build();

Open in new window

But i just realized that there will be two caches on M1 and M2 separately. That could be an issue because say M1 caches data for a user. But the load balancer than sends the request to M2 and it will have to again fetch data.
what are the possible solutions to this ?
I can think of keeping another machine with all the cache data in RAM.
And so create a cache on M1 and M2 that programmatically connects to this machine.
But then comes the problem of having one more replica of this machine because in case one is down then
we still have data access...
Please suggest what is used to solve this type of problem ?

Hi Experts,

java.lang.ArrayIndexOutOfBoundsException is coming after jdbc batch executed

batch size 5000
i have total -5500
batch executed 5000 inserte data successfully
rest of the records failed to execute

if i give batch size 5500
all the date is inserted successfully

refer code here

I would like to use Junit test for Code below
ANy One help do do " Testing JUnit  "

package com.nam.designer.GUIComponent.Editor.Ecran;

import org.dom4j.Element;

public class BWTabViewContainer extends BWContainer{
	private static final long serialVersionUID = 512395545947425467L;
	private int activeTab=0;
	public BWTabViewContainer(String name, Element node, BWComponent parent, int interfaceType) {

Open in new window

public int getActiveTab(){
		int i=0;
		for(BWComponent child: this.getChilds()){
			if(child.getNode()!=null && "true".equals(child.getNode().attributeValue("isActiveTab"))){
				return this.activeTab;

Open in new window

           return this.activeTab;
public void setActiveTab(int activeTab) {
		this.activeTab = activeTab;

Open in new window

public Object clone(){
		BWTabViewContainer o = (BWTabViewContainer) super.clone();
		return o;

Open in new window

can any one provide an sample application for tomcat 7.x that can trigger OutOfMemory and hung threads?.
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Hello there,

I have a 3 web application which I want to run one 1 instance of Tomcat on Ubuntu server. Now at present when i type in the browser from my laptop I can connect to my tomcat server and the web page is shown. Now I went a step forward by, instead of the ip i want to enter the some name like but it is not working, i get a white screen and on the browser title it says Site under construction(dont know where it gets this title from). I am referring to this link for help Can somebody please help me.

Hi Team,

I need an help on Scanner class in java . I need some help on how to use the Scanner(Readable src) , Scanner(ReadableByteChannel src , String charSetName). with an example
Any help is really appreciated.
How to insert excel file bulky data into database using java
I have installed apache tomcat 7.0.90 on my windows 8 64bit system. This is how I have configured my tomcat-users.xml -

<?xml version='1.0' encoding='utf-8'?>
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  See the License for the specific language governing permissions and
  limitations under the License.
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They 

Open in new window

Hello There ,
 I am new to Spring framework , i started to learn Spring MVC framework , i am currently trying to use internationalization (i18n)and localization (i10n) and every thin is going as expected

but here is my question in my project i have just 3 JSP and i have apply the (i18n) concept on them but i am wondering what if have 100 JSP , do i have to write a code and labels for all 100 JSP or can i make my all of my JSP app internationalized  just by clicking on a link to change between languages i want ???
what are differences between

mdb enterprise java beans.

when to use which one

any practical examples on them to see differences.

any links, resources, videos?
please advise
I am new to Spring MVC and I am trying to build a simple web App I am using Hibernate with Spring MVC. I am trying to implement CRUD operations in this web app, all CRUD operates properly except the update although DAO And Service Layers are working properly the problem here is about the JSP's and controllers. whenever I click update from the table it took me to the desired page to enter new book info but from the Update page when I click on update book submit button it stays on the same page and it does not call the desired controller method to take me where I want. I am talking about the last two methods.

Here is the Controller

package com.abed.controllers;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.abed.models.Book;
import com.abed.service.BookService;


public class BookController {

    BookService service;

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String 

Open in new window

Hi Experts,
According to my work , iI have a java code which generate shell script for ftp files.
So in the code
ftp.append("cd /home/user/user output/files for June ");

Open in new window

But according to shell script , If folder name contains space, then either we need to keep complete path inside quotes or space we can replace with back slash
for eg
cd "/home/user/user output/files for June " 
cd /home/user/user\output/files\for\June

But in java , It is not allowing me to put both  back slash \ and " saying invalid escape sequence.
How can I resolve it?
Thanks in Advance Experts............
Our client are calling one web API developed by us thru URL. They are getting below http response error -

406 Not Acceptable:1

What could be the reason? Previously API was called without any http request header and it worked well for many months.

my $response = $ua->get($url);

Open in new window

Suddenly we started getting above error. Now they have changed API calling code to send empty http request header with just one attribute "User Agent". They are not passing any value for this attribute. But after this change, it started working again.

my $response = $ua->get($url,'User-Agent' => '',);

Open in new window

What could be possible reasons for it to stop working suddenly and throwing back 406 error? How can I investigate?
Cloud Class® Course: Certified Penetration Testing
LVL 12
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Hi Experts,

List<String> list = new ArrayList<String>();
i have to iterate the list
split the string into two  parts as below
String countries = 'gh','sg','hk','ke';
int custId = 123,456,789,968;
Hi Experts,

i want to know table having data or not
in select query i will pass account no dynamically
can i use executeUpdate() for select queries or i have to use execute method

in executeupdate if the table having data it will return>1
else it will return 0.

i have a doubt is it good practive to use or i have to use execute()?
Hi Experts,

HashSet<TestData> hashset = new HashSet<>();

using select query getting data from Test1 table and adding data in TestData Object, then finally adding it in hashset.
now hashset is haviing 1000 records.

i want to insert this data in Test2 table(different database).

in Test2 table might have the same record if the record is available need to do update the values
if no data available in Test2 table need to do insetion.

Can some suggest me best way to do insert or update in Test2 table using jdbc.
Recently got frustrated trying wsimport on several old SOAP sites. Found out its all been deprecated so no SOAP sites to run wsimport on.
Can anyone give me a few just to see that wsimport is working as I expect it should?
I would appreciate a chance to test these things also .
So other than web pages processing JAX-RS(Restful) links exactly what if anything is equivalent to WSDLs in the JAX-RS world
I mean put, post, get delete insert? httpd protocol.
Hi Team,

According to my work, I have to run 7000+ sql statements in DB2 .I have the java code of the same.But by default DB2 java can only run 1338 dynamic statements at one time.
So what I was doing that Split the input data (7000 + ) into mulitiple txt files and run program more than 7 times .Each time I have to change the input path file.

Now  instead of running program 7+ times and manually changing input path everytime,I m trying to dynamically read all the input files from that folder.
Here I am attaching a part of my program only..only the method to read input file.
Below is the code for single input file case. Assume I have files named as a.txt,b.txt,c.txt.....etc.
Text file contains data in the below format:-
Existing code which executes fine  for single input file

declared input file path
static String fileName="C:\\Users\\john\\Desktop\\policies.txt";

Open in new window

main method.
 public static void main(String[] args)
    Pre pd = new Pre();

//other methods as a part of my work

Open in new window

read+policy method
public void read_Policy_list_file (String fileName)
				BufferedReader br = new BufferedReader(new FileReader(fileName));
				try {
				    StringBuilder sb = new StringBuilder();
				    String line = br.readLine();

				    while (line != null) 

Open in new window


Wonder why screen 2 approach better than screen 1 approach.
Please advise

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