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

want to read a file line by line , each line want to store in string array and want also total no of lines

BufferedReader input = null;
            int numLines = 0;
            String[] lines = null;
            try {

                  input = new BufferedReader(new FileReader(lFilePathStr));
                  try {
                        String line = null;

                        while ((line = input.readLine()) != null) {
                              numLines++;
                        }
                        for(int count = 0; count < numLines; count++) {
                              
                              lines[count] = input.readLine();
                    }
                  } catch(Exception e) {
                        e.printStackTrace();
                  }
            } catch (IOException ex) {
                  ex.printStackTrace();
            }
            
            
            
      in below line only 1st line read after that it will come in catch block please let me know where i am wrong.
0
OWASP: Threats Fundamentals
LVL 19
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

hi how can i set java home in linux
i did this in my /etc/profile
java path
but everytime when i start my vm i have to manual set java home
it always point to this
java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

i try this
find /usr/lib/jvm/java-1.x.x-openjdk
find: ‘/usr/lib/jvm/java-1.x.x-openjdk’: No such file or directory

i what to do this
find /usr/lib/jvm/java-1.x.x-openjdk.
vim /etc/profile. ...
Press 'i' to get in insert mode.
add: export JAVA_HOME="path that you found" export PATH=$JAVA_HOME/bin:$PATH.
logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell.
0
Can someone share the exact steps (step by step) on how to set
X-frame-options in Weblogic (10.3.6, 12.1.3, 12.2.1.3)  & Tomcat
to SAMEORIGIN to fix XFS/clickjacking?


I'm running Solaris 10 & RHEL 6  OS
0
hi how do i add oracle sql data source when creating spring boot application my database in oracle database 12c
spring
0
hi am geting the following error

11 Sep 2019

18:37 All files are up-to-date



18:37 Error running 'All in tdm-pet-clinic': No junit.jar
this is my pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
 
    <groupId>guru.springframework</groupId>
    <artifactId>tdm-pet-clinic</artifactId>
    <version>0.0.5</version>
 
    <modules>
        <module>pet-clinic-data</module>
        <module>pet-clinic-web</module>
    </modules>
 
    <packaging>pom</packaging>
 
    <name>tdm-pet-clinic</name>
    <description>SFG Pet Clinic Project</description>
 
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
 
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <jaxb.version>2.3.0</jaxb.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
    </properties>
 
    <dependencies>
        

Open in new window

0
hi am geting the following error

Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/9.0.20
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          May 3 2019 22:26:00 UTC
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.20.0
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Java\jdk1.8.0_111\jre
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_111-b14
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\Desmond\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Sep 09, 2019 8:31:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Program Files\Apache Software …
0
I really must know how to do this. Security on my workstation only allows confirmed downloaded files and no network interaction with Eclipse Marketplace.

So I require ideally a downloaded binary file I can simply drag and drop to install.

Any special instruction would be great.
AGAIN - ABSOLUTELY NO INTERACTION WITH ECLIPSE MARKET PLACE - PRETEND IT DOES NOT EXIST
0
i have a code below where i am traversing a list in jsp containing employee_id and employee_name
<tr>
                                                <td align="top"><INPUT class="inputtext" name="chkBox" type="checkbox" value="<%=employee.get(0)%>" size="50"></td>
                                                <td><label><%=employee.get(0)%></label></td>
                                                <td><label><%=employee.get(1)%></label></td>
</tr>

along with each and every row there is a checkbox when i am selcting chekboxes and click on submit button presently on employee_id (value="<%=employee.get(0)%>") is going along with
checkbox value i want both employee_id and employee_name will go with checkbox value to servlet . in servlet there is a query run and employee_id and
employee_name should be entered into specific table. please help me out on this .please let me know if not clear.
0
HI Team ,

I am retrieving value from database through JDBC statement  my plsql query is below -

Select * from A union Select * from B.

but when i am retrieving value through JDBC statements its give null . when i am individually running query like Select * from A without using Union  its working fine and giving results but when i am using 2 query via Union its give Null. Please tell me where i m wrong .
0
I have written my first Spring MVC controller. While I have no problems with GET requests, I am still having some issues with POST methods.

This is the code in my controller:
@RequestMapping(value = "/editorsWriters", method = RequestMethod.POST)
    public <HttpServletRequest> ResponseEntity<List<FreelancerContactWriterListView>> getEditorsWriters(
                                                                    @RequestParam int[] languageIds, 
                                                                    @RequestParam int[] summaryGroupIds, 
                                                                    @RequestParam String[] writerStates,
                                                                    HttpServletRequest request, HttpServletResponse response) {

        WriterState[] writerState = Arrays.copyOf(writerStates, writerStates.length, WriterState[].class);
        

        List<FreelancerContactWriterListView> writers = writerService.getActiveWriters(languageIds, summaryGroupIds, writerState)
                                                                    .stream()
                                                                    .map(writer -> this.convertTo(writer))
                                                                    .collect(Collectors.toList());

        
           return new ResponseEntity<List<FreelancerContactWriterListView>>(writers, HttpStatus.OK);
    }

Open in new window


and this is the JavaScript code:

 $("#search").on("click", function(e) {
            var languages=$("#languages").val();
            var summaryGroups = $("#summaryGroups").val();
            var writerStates = $("#writerState").val();
            
            var myObject = new Object();
            myObject.languageIds = languages;
            myObject.summaryGroupIds = summaryGroups;
            myObject.writerStates = writerStates;

            var myData = JSON.stringify(myObject);

            console.log(myData);

            $.ajax({
                method: 'POST',
                dataType: 'json',
                data: myData,
                url:'/api/pps/contactFreelancers/editorsWriters',
                contentType: "application/json"
            })
            
        });

Open in new window


This is the JSON sent:

{"languageIds":["1"],"summaryGroupIds":["11"],"writerStates":["PROBATION","REGULAR"]}

Open in new window


The problem is that I get a POST 404 (Not Found) error in the JavaScript console
POST https://dev1.getabstract.com/api/pps/contactFreelancers/editorsWriters 404 (Not Found)

and the following message in the terminal of my IDE:

2019-07-14 22:49:06,923 DEBUG [BaseControllerExceptionHandler] Page not found for the URL https://dev1.getabstract.com/api/pps/contactFreelancers/editorsWriters with query null: Required int[] parameter 'languageIds' is not present

Open in new window



So it is reaching or sending the POST to the correct URL, but what am I doing wrong?

Is the way I have created the data wrong?
languages, summaryGroups and writersStates are all arrays and I am putting them together into one JSON.

Thanks for your help

Massimo
0
Microsoft Azure 2017
LVL 19
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

It seems that I got the wires crossed & ask you to point me the right direction.

I have a problem with the Eclipse IDE for Enterprise Java Developers (version: 2019-06 (4.12.0), build id: 20190614-1200). There is a code part where I get the error message 'MysqlDataSource cannot be resolved to a type'. Searching the Web, I found out that this class is included in the download of mysql-connector-java JAR 8.0.14 with all dependencies. I added it over the 'Fix project setup…', where I selected the JAR file to the libraries of the Java Build Path.
Java Build Path window with the Libraries tabUnfortunately, the error message does not vanish. Can you see what I am doing wrong? The dialog accepts both JAR & ZIP files.
0
Hi

how to add jar in another spring boot application

I have created one spring application which contain filter i have created that application as a jar and include in another spring boot application .

but that filter is not working ?
jar in Maven dependency i added in pom file also . but it does not call the jar
0
HI,
I have the following curl request and response :

curl 'https://sso.zeapps.in/renw-seseep-alive' -H 'Upgrade-Insecure-Requests: 1'
 -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/74.0.3729.169 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,
image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'Referer: https://web.zetaapps.in/' 
-H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7' -H 'Cookie:
 __cfduid=dccce009d1b93daca71ebd131558887475; _ga=GA1.2.602226.1587478; _gid=GA1.2.197749.1505258; 
connect.sid=s%3AV74P3e3NKIwARYetmmW3PzXR.wJoT7tQbfUk3GQhMO7OZ026OTDSWsJTMI; _gat=1; 
amplitude_idzetaapps.in=eyJkZXZpY2VJZCI6IjExZmVhMDUwItN1iYTEyLTFhNdCI6ZmFsc2UsInNlc3Npb25JZCI6M
TU2MDE4MjkwNzEzNywibGFzdEV2ZW50VGltZSI6MTU2MDE4Mjk2Mjc4NCwiZXZlbnRJZCI6MCwiaWRlbnRpZnlJ
ZCI6MCwic2VxdWVuY2VOdW1iZXIiOjB9; AWSALB=bIejBRzXqtKh/dsTqgCZyQpUTLqzjm5so+pQUS32gLmQAybM6Dz/8y8IKmD14IPY/o0NVF8+gIjAZSMRFso+
UHL8aT7iehq4WdRaJU0aIX2GF21' --compressed
<p>Found. Redirecting to <a href="https://web.zetaapps.in/#/setup-guide?
authToken=TOVJPQ%3D%3D&amp;trackingCookie=e3NKIwARYetmmW3mvaPqQ2TPzXR&amp;userId=117&amp;
userJID=17%40zeuser.zea.in%2F31&amp;validTill=1560191914368">https://web.zetaapps.in/#/setup-guide?
authToken=T0VJPQ%3D%3D&amp;trackingCookie=e3NKIwARYetmmW3mvaPqQ2TPzXR&amp;userId=117&amp;

Open in new window

0
How to get the request and response  payload in spring handlerinterceptor ?
0
how to create annotation for interceptor

i have created one standalone application which will used by other application for audit .

in my standalone application I have created interceptor which will capture my request and response structure.

I have created this application as jar and i will plane to use in other application ?


other also spring boot application  my question is

1. is interceptor will work if i use as Jar ? no need to use any other code ?
2. if not then how we will create custom annotation for this interceptor ?

Regards,
Sathish Kumar N
0
I'm trying to change our most Agile development process to include input from the database team.  Our application is a J2EE with a heavy Oracle database transactions; using Hibernate and JPA.  Need help writing a paragraph to justify why I want to make a change to our current development process; where database experts have NO input/involvement until things don't work well or terrible performance.  I want my team to be more proactive in development.
0
Hello guys

I just finished my first course of Java fundamentals.
I have many years of Visual Basic and visual foxpro programming.

Yet I’m confused at how Java is set up (framework) and what can be done and what can not be done.
I’m trying to learn it Step by step.
The question I have for now is the following:if I want a GUI where I can design a screen with buttons and grids etc...
I’m sure it is feasible. But using what Editor ? What version. ?

Sorry if my question seems silly ....
0
Hi Experts,

String xmlStr = "<msg><request><GroupId>001KYL</GroupId><RptCode>68705</RptCode></request> <response><fpath>001KYL/ESUSER2/</fpath></response></msg>"

Open in new window

xmlStr i am getting from DB dynamically,this value will be keep on change.

now i want to convert this string into json format

Thanks
0
I have a very large data file with millions of transaction records. A typical transaction structure will be something like "Transaction ID, Customer ID, and more columns for other details". Transaction ID is unique across the file. Customer ID can repeat as there could be multiple transactions from the same customer, and these can come sequentially or could be distributed across the file. I want to process this file using multithreading. But the condition is that at any given time, only one customer can be processed by any thread which means if any thread is processing a transaction for customer id 100, then no other thread can pick up any other transaction for that customer id 100 till that thread completes processing for the current transaction. I know some synchronization is required around customer id but can someone suggests how we can achieve this in the best manner? The language is java.
0
Fundamentals of JavaScript
LVL 19
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Q1:
Does  JDK 1.6, JRE 6 & J2EE 1.6 have the same End of Support date (ie beyond
which there's no further patch/support fr Oracle)?

Q2:
I'm looking at JDK 1.8, JRE 8, J2EE 1.8 : what's their End of support date

Q3:
& do they (the 3 items above) simply have a common EoL/EoSL date as Java 8?    

Q4:
So the products that are bundled with above Java items (eg: Weblogic & JBoss)
will have their EoL/EoSL the same as  the versions of bundled Java or usually
they're different & we can update/upgrade the Java components separately?
0
In my shop we continue to be in "database performance hell"; albeit highly suspect our J2EE application code's poor design.  It is well known our application has problems, but at the end of the day everything culminates with the database.  Our application developers use Hibernate, and JPA to interface with our 3-Node Oracle 12c RAC database.

We are generating all of the usually reports ( AWR, ADDM, ASH ) in an attempt to nail down where the problems are.  And, yes the reports have identified 8 or so really bad queries, in some cases with either no recommendation, or recommendations to re-write.  Should have mentioned earlier, the database team does write or generate any of the SQL-queries for the application, these are all originated from the application developers.

We now realize performance should be monitored over a period of time. These reports are not easy to understand and as you know have a huge amounts of information.  Hugely suspect some information is more relevant than others.

 Big question:  if my team needs to focus in on 3-4 items in the AWR, ADDM, ASH reports --which/what items should we set our attention to?
1
Database errors seem to manifest in the database, during the execution of our J2EE application.  Recently we got ORA-17008 errors, "Resource manager is unavailable".  We have googled and mostly all we find, "connection closed error and the application is not handling the error".  My DBAs are not experts in Java, or Karaf our application server.  I don’t have any intelligent answers, but need to report to management ASAP.  Please help.
0
My application is experiencing very frequent database locks, getting ORA-02049 distributed timeout locks.  Of course our J2EE developers point to the DBAs, and my DBA team is pointing to bad code produced by inexperienced JAVA coders.  Most of the Java software developers have limited knowledge of how a RAC distributed database works. And as you can expect Management is furious.

How can we nail down any locks in the database?  How can we query gv$lock and determine, what query/tables are complicit in the application.  We need to quickly identify either the offending code, or badly formed queries, or combination of both.  I have found these specific queries, but need to know how to take this 2-steps forward and get the query that is part of the lock.  We are running under Solaris, with a 3-node Oracle 12.1 RAC database.  Things are really bad, please help.

select event,p1,p2,p3 from v$session_wait
where wait_time=0 and event='enqueue';

Show sessions waiting for a TX lock:
select * from v$lock where type='TX' and request>0;

Show sessions holding a TX lock:
select * from v$lock where type='TX' and lmode>0;
0
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
Hi,
I want to build an api that given a stock id provides the high, low, open, close values for it at the end of the day.
Now i thought of two approaches
1) Keep all the data in memory in a Map<String, Stock> where String is the stockId
2) Upload all data to an Excel file and clients can fetch that file.

Now i can use a mix of the solutions  -
A client can either want one stock value or it can want all the values.
In the first case i will use the map.
In the second case i have a choice
1) Either to return the whole map as a json
2) Provide client a url to download the file.

Although both seems similar as at the end all we are doing is sharing data.

What are the pros and cons of both the approaches.
I can think of the following :
File uploading
1) File uploading will need  a s3 bucket setup an extra thing.
2) Benefit is that we can store older copies of the file and clients can easily access older copies if they want

Json
1) No need for anything extra. Its just plain and simple return the whole json from the map.

Please confirm if above what i wrote is correct. And also any other pros and cons you see.

Thanks
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
>