[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

Need help on Spring Boot Project Structure to be deployed in an external tomcat.

Files we have

1. Html
2. css
3. javascript
4. back-end files - controller, service, repository etc.,
5. Angular JS

Please advise.
0
JavaScript Best Practices
LVL 12
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

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
WildFly Full 12.0.0.Final (WildFly Core 4.0.0.Final) - java.lang.OutOfMemoryError: Java heap space Error and crashes.

OS: Centos 7
Java: JDK 8

Problem: Everyday in peak hours, server is stop responding. Getting HEAP error.

JVM OPTS used:
-server -XX:+DoEscapeAnalysis -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:+ExplicitGCInvokesConcurrent -XX:CMSInitiatingOccupancyFraction=80 -XX:CMSIncrementalSafetyFactor=20 -XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -Xloggc:gc.log.`date +%Y%m%d%H%M%S` -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:CompressedClassSpaceSize=2048M -XX:MetaspaceSize=2048M -XX:MaxMetaspaceSize=2048M -Xmx16G -Xms16G  -Djava.net.preferIPv4Stack=true

Open in new window


Exception:
2018-11-26 09:05:35,740 ERROR [org.jboss.threads.errors] (default task-41) Thread Thread[default task-41,5,main] threw an uncaught exception: java.lang.OutOfMemoryError: Java heap space

2018-11-26 09:08:10,951 ERROR [org.jboss.threads.errors] (default task-12) Thread Thread[default task-12,5,main] threw an uncaught exception: java.lang.OutOfMemoryError: Java heap space

2018-11-26 09:04:21,639 ERROR [org.jboss.threads.errors] (default task-4) Thread Thread[default task-4,5,main] threw an uncaught exception: java.lang.OutOfMemoryError: Java heap space

2018-11-26 09:08:10,950 ERROR [org.jboss.threads.errors] (default task-30) Thread 

Open in new window

0
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
Hi All,

Is this possible to invoke vba macro subroutine with arguments from java code?

Thanks,
Varun Walia
0
How  can I  resolve  this Error?I am a newbie in Graphql..I am trying  to call  graphql  API in angular.Below is my  code

export type DataTagsNames = {
	DATA_TAG_NM:String;
	DATA_TAG_ID:String;
	DSPLY_LINE_CNT:String;
	FLD_ENBL_IND:String;
	CNTXT_SCRN_IND:String;
	SHOW_DATA_IND:String;
	INJ_IND:String;
	RLT_ENTY_NM:String;
	CNTXT_SCRN_GRP_NM:String;
	PRTPT_TYPE_CD:String;
	DATA_TAG_PRTPT_CD:String;
	DATA_TAG_PRFM_R_CD:String;
	READ_ONLY_IND:String;
	EMTY_DLTE_IND:String;
	STWRD_EDT_IND:String;
}

export type Query = {
	allDataTagsNames: DataTagsNames[];
}

Open in new window

export class ListComponent implements OnInit {
  datatagsdetails: Observable<DataTagsNames[]>;
  constructor(private apollo: Apollo) { }

  ngOnInit() {
    this.datatagsdetails = this.apollo.watchQuery<Query>({
      query: gql`
        query allDataTagsNames {
          DataTagsNames {
           
          DATA_TAG_NM
           DATA_TAG_ID
           DSPLY_LINE_CNT
           FLD_ENBL_IND
           CNTXT_SCRN_IND
           SHOW_DATA_IND
           INJ_IND
           RLT_ENTY_NM
           CNTXT_SCRN_GRP_NM
           PRTPT_TYPE_CD
           DATA_TAG_PRTPT_CD
           DATA_TAG_PRFM_R_CD
           READ_ONLY_IND
           EMTY_DLTE_IND
           STWRD_EDT_IND

          }
        }
      `
    })
      .valueChanges
      .pipe(
        map(result => result.data.allDataTagsNames)
      );

Open in new window

0
Introduction to Web Design
LVL 12
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

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
Hi,

I am looking for a good comprehensive book or video on a real life enterprise project implementation in java and related technologies end to end. I am looking for something which will guide me starting with business analysis, database design, software design and architecture, select various tools and technologies for the project, project implementation in java and related framework and finally deployment. Is there anything available which can help me? Thanks.
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
Can anyone please  help?I am a newbie in GraohQL,...I am   trying  to expose my  API using  GraphQL  . I am  getting the  error  below


Here  is  my  schema:-

type Query {
  payloads: [payload!]!
}
type serviceStatus{
    status:Int!
}

type payload {
     links:[link]
     catastrophe: Boolean
     number: String
     status: String
     fileType: String
     createDateTimestamp: String
     id: String
     recordOnly: Boolean
     lineOfBusiness: String
     stateCode: String
     dateOfLoss: String
     confidentiality: String
}

type link {
      rel:String
      href:String
}
And below is my  resolver  method:-


public ResponseEntity<String> payloads(){
    	 
    			 			
    		   String uri = "URL  to my  API";		
    			HttpHeaders headers=new HttpHeaders();
    			


    			RestTemplate restTemplate = new RestTemplate(); 
    			return restTemplate.exchange(uri,HttpMethod.GET,entity,String.class);	
    			
    			
    			
    			
    			
    			
    			
    			
    			
    			
    			
    			
    			
    }





















Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletRegistrationBean' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletRegistrationBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating 

Open in new window

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
Experts,

is it good to have a ParseException or try catch   which would be much better way handling...

@CrossOrigin
      @RequestMapping(value = "save/", method = RequestMethod.POST, produces = { "application/json" })
      public Map<String, Object> createCounseling(@RequestBody String counselingData) throws Parse{
            JsonObject CounselingObject = Json.parse(counselingData).asObject();
            HibernateDao<Counseling> workerDao = counselingDaoFactory.getNewDao(Counseling.class);
            Counseling counseling = getCounselingObject(CounselingObject);
            Map<String, Object> counseilingMap = new HashMap<>();
            workerDao.save(counseling);
            counseilingMap.put("status", HttpStatus.OK);
            counseilingMap.put("data", new ArrayList<>());
            return counseilingMap;
      }

Thanks
0
Learn Ruby Fundamentals
LVL 12
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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
I have a java program which will connect to DB and write into an excel sheet.

Now I would like to make each sheet in workbook as a table and print in outlook and sent via mail also attaching the mail excel sheet using java program.

Any thoughts
0
Hi All,

How to copy some rows of data from excel sheet to new excel sheet in mac using java and if possible throw mail with the attachment of new excel sheet?

Note: Mac office 2011

 Thanks.
0
Encountered Error as below on tomcat v9 server post deploying WS and trying to extract the response in SOAP UI

[/services/flasht] only the HTTP methods [POST GET] are covered. All other methods are uncovered.
02-Oct-2018 15:43:01.331 SEVERE [main] org.apache.tomcat.util.descriptor.web.SecurityConstraint.findUncoveredHttpMethods For security constraints with URL pattern [/management] only the HTTP methods [POST GET] are covered. All other methods are uncovered.
02-Oct-2018 15:43:01.331 SEVERE [main] org.apache.tomcat.util.descriptor.web.SecurityConstraint.findUncoveredHttpMethods For security constraints with URL pattern [/Response] only the HTTP methods [POST GET] are covered. All other methods are uncovered.
02-Oct-2018 15:43:28.901 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
02-Oct-2018 15:43:28.901 INFO [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
02-Oct-2018 15:43:28.904 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@461270d7')
02-Oct-2018 15:47:57.945 SEVERE [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable
 java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
      at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:136)
      at …
0
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
qry:            
select txnCount,currency,amount,days from test where country='IN' AND ROWNUM<=5;

IT MAY FETCH MAX 5 RECORDS
SOME TIME 1 or 2 or 3....
if the rocords count is less than 5 i have set val as NA
EACH COLUMN I NEED TO FETCH VALUES AND SET INTO LIST THEN NEED TO CONVERT IT AS STRING

LET SEE if the above qry fect 3 records
i want to see txnCount column as "23,34,56,NA,NA"
OUTPUT
String txnCount-->"23,34,56,NA,NA"

similary for the rest of the columns as well

i have written below code is there any better approach?

ResultSet rs = st.executeQuery(Query());
		List<String> txnCount = new ArrayList<String>();
		List<String> currency = new ArrayList<String>();
		List<String> docAmt = new ArrayList<String>();
		List<String> avgDays = new ArrayList<String>();
		
		
		System.out.println("size " + rs.getFetchSize());
		while (rs.next()){
			txnCount.add(rs.getString(1));
			currency.add(rs.getString(2));
			docAmt.add(rs.getString(3));
			avgDays.add(rs.getString(4));
			year = rs.getString(5);
		}
		System.out.println("txn sisss "+txnCount.size());
		System.out.println(5-txnCount.size());
		int size1 = 5-(txnCount.size());
		for(int i=0;i<size1;i++){
			txnCount.add("NA");
		}
		int size2 = 5-(currency.size());
		for(int i=0;i<size2;i++){
			currency.add("NA");
		}
		int size3 = 5-(docAmt.size());
		for(int i=0;i<size3;i++){
			docAmt.add("NA");
		}
		int size4 = 5-(avgDays.size());
		for(int i=0;i<size4;i++){
			avgDays.add("NA");
		}
		String txnCnt= 

Open in new window

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.

Top Experts In
Java EE
<
Monthly
>