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

I had this question after viewing Triggering a shell command from a java servlet 30 minutes after the http call.

Hi,

In this how do I set up a timeout for the thread after the thread is spawned. I am noticing that in my app the thread is getting stuck due to some other issues. And I need to setup a timeout property for the thread

thanks
-anshu
0
CompTIA Cloud+
LVL 13
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Looking for examples of modern distributed web applications.

Hello all,

I am trying to understand some examples of complex modern web applications which are used in companies like Kroger , Office Depot or financial companies like Freddie Mac , Fannie Mae etc.

If someone wants to one day get ready to work in these companies as a junior / senior programming what all things they should know

this is a very broad question but some answers will help me ask some more targetted specific questions

I am very interested in learning about designing and making Enterprise Applications

thanks
-anshu
1
From an Execute Process task in SSIS I am running a PowerShell script that passes a couple parameters to a .bat file on a remote server that starts a vendor application we use. The process does work as I've tested it with an extremely small test file.

When I execute it with the actual file it takes hours. Whereas if I simply ran the .bat file on the server it takes 15 minutes.

When I check the application server where the .bat file is located, the CPU ranges from 70 to 95% usage and I am the only one on the server. The process taking the CPU is "Java(TM) Platform SE binary".  Is there anything I can do for a work around? We are a healthcare company and everyone has very strict roles and privileges. So I am prohibited to tweaking the server setting (if that's even the problem) w/o opening a help desk ticket. Or perhaps the way I'm trying to execute this just isn't efficient. I've been at this for a few days now. So maybe I'm overlooking something obvious. I see online that this process seems to be a problem for a bunch of folks. I just can't seem to find a solution online. Any assistance is appreciated.
0
HI EE

I'd like to create the following Jboss topology environment.

Jboss EAP 6.4

2 x Domain controller failover
2 x slave node hosting 3 servers

I know how to configure 1 domain with 2 slave node, but for 2nd DC for failover, anyone can give me some guide?

Thanks
0
Our J2EE application is about to release a new version.  One of the changes desired is to modify/change an existing column datatype from a BLOB datatype to a VARCHAR2.  This table has over 12,000 rows.  So, how do I "alter" this column datatype?
0
I have a dynamic web project ( SOAP web service), which takes parameters from a received message and inserts data to oracle db. This all works fine. However, db connection url, password and user are hardcoded.

This web app will be distributed to a number of servers with different db connection details, so it can't be hardcoded and generating a new app for each server is not an option.

I wonder if I could store needed info in an xml file and read from there. Is someone able to give me a nice simple example of how to do it?

Also, where such file would have to be placed, bearing in mind it would have to be possible to edit it after the deployment?
0
Hello,

I generated soap web services using Eclipse JEE, which then I deployed ( .war) on Tomcat 7.0 on Centos 7 -  this works fine.
The aim is to insert a data received in an xml and insert it to an Oracle table.

I've added the below code to a java class file, which meant to do some insert statement ( which is valid ) , with hardcoded values, just to prove I can do it.

    public void InsertValue(String MessageId, String value){
    	try{

    	Connection con=null;
    	Class.forName("oracle.jdbc.driver.OracleDriver");


    	con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xxx", "xxx","xxx");
    	Statement s = con.createStatement();

    	s.execute("INSERT INTO ping_message (message_id,dstamp) VALUES ('1',To_char(SYSDATE))");
    	con.setAutoCommit(true);
    	s.close();
    	con.close();
    	}catch(Exception e){
    	System.out.println("ERROR: "+e.getMessage());
    	}
    	}
    

Open in new window


Unfortunately, this does not work. I wonder if this is because of the java code or Tomcat needs some db drivers in order to establish a connection the database ?

btw, my java skills are being developed as I type this :)
0
lets say i have method called
 testSum(){
c=a+b;
}

i clicked on testSum
i did CONTROL+ALT+H i see call hierarchy results
if I clicked testSum did CONTROL+H  then i get search option with my method and its class, package selected automatically and i click SEARCH without changing anything(it says java search)

how above call hierarchy different from java search is different from previous one?

please advise
0
Hi,
There is following code -
 
     
   public CompletionStage<Void> addEmail(Long userID, String email) {

      CompletableFuture<GetMappingResponsePayload> getMappingResponsePayloadCompletionStage =
              (CompletableFuture<GetMappingResponsePayload>) addressResolver.getEmailMapping(email);

    return addressResolver.addEmailMapping(email, userID)
        .thenCompose(__ -> emailsDao.upsertEmail(userID, email, true));

Open in new window

I want to fetch the object GetMappingResponsePayload from above.
The getEmailMapping function is a synchronous call so when the code gets executed the result will be there.
To give the context there is a Boolean attribute inside GetMappingResponsePayload and based on that
i want to return an exceptionallyCompletedFuture in case the value is false.
otherwise the next return statement is executed.
How do i achieve this neatly

Thanks
0
Hi,
What does __ mean here : .thenCompose(__ -> emailsDao.upsertEmail(userID, email, true));
This is from CompletionStage
thanks
0
OWASP Proactive Controls
LVL 13
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Hi,
What is this code doing -
 private CompletionStage<Object> update(UpdateAtmEnabledRequest payload, CompletableFuture<KycInfoV2> kycInfoV2Future, boolean shouldUpdate) {
        if (shouldUpdate) {
            KycInfoV2 infoV2 = kycInfoV2Future.join();
            infoV2.getAttrs().addProperty(ATM_ENABLED, payload.getAtmEnabled());
            return kycProfileDao.upsertKycInfo(payload.getUserID(), kycInfoV2Future.join())
                .thenCompose(___ -> updateCloudcard(payload.getUserID(), payload.getIfiId(), infoV2.getPanNumber(), payload.getAtmEnabled(), infoV2.getEffectiveKycStatus()))
                .thenCompose(__ -> userProfileDao.updateKycData(payload.getUserID(), null, null, ImmutableMap.of(ATM_ENABLED, payload.getAtmEnabled().toString())))
                .thenCompose(____ -> {
                    profileUpdateRecorder.recordUpdate(payload.getUserID(), new ProfileUpdateModel()
                        .action(UPDATE)
                        .field("ATM_ENABLED")
                        .value("IFI" + payload.getIfiId() + "ATM_ENABLED" + payload.getAtmEnabled().toString()));
                    return completedFuture(null);
                });
        }
        return completedFuture(null);
    }

Open in new window


I need to understand more of this CompletionStage, CompletableFuture.

Thanks
0
Hi,
I was reading a codebase need some help in understanding it.
What does the following annotation means ?
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(AuthorizedContainer.class)
@Inherited
public @interface Authorized {
    String value() default "";

    String[] anyOf() default {};
}


@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface AuthorizedContainer {
    Authorized[] value();
}
And the code to process seems to be this :


//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package in.zeta.commons.interceptors.authorization;

import com.google.common.base.Strings;
import in.zeta.commons.annotations.Authorized;
import in.zeta.commons.annotations.AuthorizedContainer;
import in.zeta.commons.util.Futures;
import in.zeta.spectra.capture.SpectraLogger;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Inject;
import olympus.message.processor.Interceptor;
import olympus.message.processor.InterceptorException;
import olympus.message.types.Payload;
import olympus.message.types.Request;
import 

Open in new window

0
how to load mutiple jks file(keystore) file in jmeter.
0
MQ under glassfish called imqdbroker not running when i double click on windows laptop.
path is
C:\Program Files\glassfish-4.0\mq\bin
i am not able to open default hosts under jms host to see that same mq that is supposed to be started
Please advise
MQ_glasfish.png
MQ_glasfish_2.png
0
hi,

I build one stateless session bean example with presentation tier html inddex page and web tier servlet within ejb web project then business tier in the ejb project


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form action="ConverterServlet" method="POST">
              <input type="number" name="value"></br>
              <select name="type">
                    <option value="C2F">celcius to fahrenheit</option>
                    <option value="F2C">fahrenheit  to celcius</option>
              </select></br>
              <input type="submit" value="Convert">
        </form>
            
    </body>
</html>

Open in new window


do i not need to add close tags for input html element
<input type="submit" value="Convert">

also do i not need to ad begin tag for </br>

please advise

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import bean.ConverterBeanLocal;
import bean.ConverterBeanLocal.ConvertType;
import java.io.IOException;
import java.io.PrintWriter;

Open in new window

0
Looking for a compelling reason to continue with my current database upgrade choice.  Currently we are proceeding down the path of upgrading from Oracle RAC database 12.1 to 12.2c, rather than the much talked about Oracle 18c.  Apparently there was much fanfare at OOW and our J2EE Software Developer are very interested.  However, I have already start my investigation/research and practice with Oracle Database 12.2c.  How can I persuade folks that 12.2 is just as a good direction? Need to be able to make really good argument.
0
I'm unable to compile first java program.

javac is not recognized.  Please see attached.
Hello_World_not_compiling.PNG
0
Hello Sirs
I am using serious issues with Charset Encoding in a REST application. I use Spring and the encoding in the bean MessageSource and Tymeleaf resolver  is set to UTF-8.
I get this when I return Json string:
\ufffd replacing special characters like é, or any other letter with accent.
How can I solve this?

Best regards.
0
Dear Experts,

let us know if logger is good for production or we have remove it out ? is that slows down at the applicationl level ?
if we use only after catch is that ok..
logger.warn("proceeding with incomplete request from mobile: {}. cause: {}, message: {}", 
					requestBody.length(), ex.getCause(), ex.getMessage());

Open in new window

let us know  in our application we are using hashmap  is that good or map would be good ?
	@CrossOrigin
	@RequestMapping(value = beneficiaryURL, method = RequestMethod.POST, produces = {"application/json" })
	public HashMap<String, Object> screeningRecord(@RequestBody String requestBody, 
			HttpServletRequest request) throws Exception {
		String remoteAddr = request.getRemoteAddr();
		logger.info("got request from: {}", remoteAddr);
		logger.debug("{}: received message: {}", remoteAddr, requestBody);
		HashMap<String, Object> screeningRespone = new HashMap<>();	
		// Transaction id is generated
		String transactionId = String.format("%s-%s", UUID.randomUUID().toString(), 
				dateTimeFormatter.format(new Date()));
		logger.info("{}: Generated id: {}, url: {}. Saving...", remoteAddr, 
				transactionId, beneficiaryURL);
		SubmissionInfo submissionInfo = new SubmissionInfo(transactionId, requestBody, 
				SubmissionInfo.PENDING, beneficiaryURL);
		Integer partition = null;
		try {
			Map<String, Object> jsonRequest = load(requestBody);
			Long microPlanId = Long.valueOf(jsonRequest.get("microPlanId").toString());
			partition = 

Open in new window

0
OWASP: Forgery and Phishing
LVL 13
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Experts,

Please have the code  and let me know what is the issue

@CrossOrigin
	@RequestMapping(value = "microplan/{teamId}", method = RequestMethod.GET, produces = { "application/json" })
	public ResponseEntity<?> visitationPlanMobile(@PathVariable int teamId) throws Exception {

		List<Map<String, Object>> responeObject = new ArrayList<>();
		try {
			responeObject = visitationPointMobile(teamId);
			return new ResponseEntity<>(responeObject, HttpStatus.OK);
		}catch(Exception e){
			e.printStackTrace();
			logger.error("Error Get Micro Plan {}",e.getMessage());
			return new ResponseEntity<>(responeObject, HttpStatus.INTERNAL_SERVER_ERROR);
		}
	}

Open in new window



public List<Map<String, Object>> visitationPointMobile(@PathVariable int teamId) throws Exception {
		Map<String, Object> queryFilter = new HashMap<String, Object>();
		queryFilter.put("team_id", teamId);
		//queryFilter.put("status", VisitationPlan.ACTIVE);
		HibernateDao<VisitationPlan> workerDao = daoFactory.getNewDao(VisitationPlan.class);
		return getVisitationPlanMapMobile(workerDao.findList(queryFilter));
	}

Open in new window


This is error comes some times making our service down

01-10-2018 11:44:34.380 ^[[35m[http-nio-8080-exec-15]^[[0;39m ^[[34mINFO ^[[0;39m c.d.d.c.VisitationPlanController.getVisitationPlanMapMobile - MicroPlan Location Id: 24395
01-10-2018 11:44:34.382 ^[[35m[http-nio-8080-exec-15]^[[0;39m ^[[1;31mERROR^[[0;39m c.d.d.c.VisitationPlanController.visitationPlanMobile - Error Get Micro Plan null
0
HI,
The problem is to design a solution for finding the number of users who are watching a particular video eg. on youtube etc.
Here is what i thought about solving it.
If the video is playing than every 5th minute from GMT it will send a play event
I will maintain a table containing  (userId, movieId, timeStamp)
So to count how many viewers playing a video i will simply have to count the number of entries in the table with the movieID and timeStamp not later than 5 minutes. Because if a play event is not recieved for 6 minutes than the video must not be playing...
And each time a play event is received the timeStamp will be updated to the current time.

Also i will run a cronJob that will be clearing entries that are not getting updated.
Will maintain a cache containing the count for each movie and will update it at a regular interval from the table.

Each video that is being played will send a https request for the number of current viewers every 6th minute and the number of viewers will be updated.
Please suggest if there is any flaw in this approach. or any better approach ?
Any pros and cons ?
Thanks
0
Hi Experts,
how to form a dynamic string array from the below inputs

String countries="sg,sk,hk,ke" //this string having country names dynamically
countries max will be five and min will be one value separated with comma(,)


i have to form dynamic string array based on above countries
user can choose any country but max will be 5 countries min 1 country
country values are dynacmic

how to form dynamic string array

exmaple:
new String[] {"sheet one"+ "sg" , "sheet two" + "sk","sheet three" + "hk","sheet four" + "ke","sheet five" + "ug","summary"}
new String[] {"sheet one"+ "sg" , "sheet two" + "sk","sheet three" + "hk","sheet four" + "ke","summary"}
new String[] {"sheet one"+ "sg" , "sheet two" + "sk","sheet three" + "hk","summary"}
0
I would like  to insert a row for  title not a Particular cell but show assign entire row cell for the title
 here is the piece of snippet code, i do not how to add a title for the entire row


....
HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet sheet = workbook.createSheet("EDR Raw Data");

    Row header = sheet.createRow(0);
    header.createCell(0).setCellValue("Header1");
    header.createCell(1).setCellValue("Header2");
    header.createCell(2).setCellValue("Header3");
    header.createCell(3).setCellValue("Header4");
0
Hello Experts,

I was writing a restful apis
I would like to have a snippet of code to  which will handle the exception like
If request was successful, then return 2xx code (3xx for redirect).
 If there was an internal logic error on a server, then return 5xx. If there is anything wrong in client request, then return 4xx code.
 like to have a user friendly description of the errors...

Thanks
0
apache tomcat 8.5.33 doesn't start up when I double click the startup.bat file from the bin directory.The window opens and closes immediately.
Please help.
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.