[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

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
Why Diversity in Tech Matters
LVL 12
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

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
how to load mutiple jks file(keystore) file in jmeter.
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
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
OWASP: Forgery and Phishing
LVL 12
OWASP: Forgery and Phishing

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

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
May I know how to popup pdf file in Spring framework?
0
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.
0
HI,
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 ?

Thanks
0
Hi,
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.bity.com/abcdefg  |  www.klasjlkajsf.comalskdfjlaksdjflkasjdfl
2) www.bity.com/abcdefg  | 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 ??


Thanks
0
Hi,
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 :

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
    private Cache<String, User> userCache;
 userCache = CacheBuilder.newBuilder()
                .maximumSize(1000)
                .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 ?

Thanks
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

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
https://www.experts-exchange.com/questions/29110374/JDBC-Batch-insert-causes-ORA-01000-maximum-open-cursors-exceeded.html
0
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 192.168.1.6 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 www.zzzzzzzz.com 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 http://www.ramkitech.com/2012/02/understanding-virtual-host-concept-in.html. Can somebody please help me.

cheers
Zolf
0
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.
0
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

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<tomcat-users>
<!--
  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
  application.
-->
<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They 

Open in new window

0
what are differences between

stateless
stateful
singleton
mdb enterprise java beans.

when to use which one

any practical examples on them to see differences.

any links, resources, videos?
please advise
0
Hi Experts,

List<String> list = new ArrayList<String>();
            list.add("gh_123");
            list.add("sg_456");
            list.add("hk_789");
            list.add("ke_968");
            
            
O/P:
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;
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
>