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 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
Angular Fundamentals
LVL 13
Angular Fundamentals

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

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
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
Become a Microsoft Certified Solutions Expert
LVL 13
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
Hi,
I came across a question which says
Design Flipkart Flash sale architecture. 2 million hits and 20k orders in 2 sec. Find out database scalability.  
Now here if we forget about what is flash sale. And some simple application with 2 million hits and 20k orders in 2 sec.
What is this database scalability all about ?
I have made small applications with not so many hits and have always used mysql database.

Thanks
0
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
Build an E-Commerce Site with Angular 5
LVL 13
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

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
Why BigDecimal.Sclae() not not working for non decimal value

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            formatBD(2,new BigDecimal(10));
            formatBD(2,new BigDecimal(10.0567));
            formatBD(2,new BigDecimal(10.05));
            formatBD(2,new BigDecimal(10.000023));
      }
      
      public static void   formatBD(int sca,BigDecimal amount)
      {
            System.out.println(amount.scale() > 0 ? amount.setScale(2, BigDecimal.ROUND_CEILING) : amount);
      }
}

Output :10
10.06
10.06
10.01
0
Hi Guys,

I'm having good fun doing my first web services and learning java, but I need your help ( again ).

Just to recap what I've done so far
1. using eclipse java ee I created Dynamic Web Project
2. I imported  a wsdl file to the project and generated web services (Top down Java bean ones)
3. I can take parameters from received requests and loaded them to Oracle database, which connection details are stored in config.properties file ( this pretty much works :) )

I've just been asked if it would be possible to grab a SOAP body and load it to an oracle table.

This is my class where web services requests are being consumed

/**
 * BasicHttpBinding_MS_aaa_WMS_ServicesImpl.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package com.bbb.WebServices;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;

import org.datacontract.schemas._2004._07.Dft_aaa_WebService.WMS_RequestData;
import org.datacontract.schemas._2004._07.Dft_aaa_WebService.WMS_RequestInfo;

public class BasicHttpBinding_MS_aaa_WMS_ServicesImpl implements com.bbb.WebServices.MS_aaa_WMS_Services{
    public com.bbb.WebServices.SendPing_WMSResponse sendPing_WMS(com.bbb.WebServices.SendPing_WMS parameters) throws java.rmi.RemoteException {
try {
			
			Connection con = null;
			

Open in new window

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

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
>