Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

pari Nagda

Ranch Hand
+ Follow
since Jun 03, 2014
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by pari Nagda

I trying to hit Spring Controller service using the mockmvc test but every time I am getting "org.springframework.web.HttpMediaTypeNotSupportedException" . I appreciate if any one refer  below details and try to suggest me .

Controller : -
@PostMapping(value="/textTranslation",consumes = MediaType.APPLICATION_JSON_VALUE , produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseBody>  translateText(@RequestBody TranslationRequest tranaTranslationRequest) throws Exception {
ResponseBody responseBody = new ResponseBody();
try {
System.out.println("In side Controller");
catch(Exception e) {
return new ResponseEntity<ResponseBody>(responseBody, HttpStatus.OK);

Test : -

public void testRequestBodyInput() throws Exception {

TranslationRequest translationRequest = new TranslationRequest("english","french","test");

MockHttpServletRequestBuilder request = post("/textTranslation");

* mockMvc.perform(post("/textTranslation").
* content(asJsonString(translationRequest)).contentType(MediaType.
* andDo(print()) .andExpect(status().isOk()).
* andExpect(MockMvcResultMatchers.jsonPath("$.test").value("test"));


    public static String asJsonString(final Object obj) {
   try {
       return new ObjectMapper().writeValueAsString(obj);
   } catch (Exception e) {
       throw new RuntimeException(e);

Spring Version - 5.0.1.RELEASE

Test Error - java.lang.AssertionError: Status expected:<200> but was:<415>
3 weeks ago

Rob Spoor wrote:That method was added in version 1.1 of the validation framework; see Since you're using JBoss 6.1, which is ancient, it probably provides version 1.0.

I'm curious though - why are you a) using JBoss 6.1, which is ancient, and b) using Spring Boot inside a container, whereas one of its main selling points is to not have to depend on a container?

1) This is the app server my company is using to serve the customers hence all the web apps deployed here  . 2) I understand Spring boot app works with the embedded tomcat but to make this app available for customers I need to expose the services from this app using company's domain( using the App server(jboss) , Right ?  - This is the reason I am deploying it on jboss.
Please correct me if the approach i am using is not the recommended one.
3 weeks ago
While deploying the Spring boot app on jboss server I am facing below error on local. Can any one please help ?

Error :
An attempt was made to call a method that does not exist. The attempt was made from the following location:


The following method did not exist:


The method's class, javax.validation.Configuration, is available from the following locations:


It was loaded from the following location:



Correct the classpath of your application so that it contains a single, compatible version of javax.validation.Configuration
4 weeks ago
I have a Spring mvc based web app where in DAO layer many try and catch blocks are there. We guys are planning to do some DB logging whenever any exception occurred.  I found there is a Global Exception Handler(@ExceptionHandler) in Spring using which I can get rid of applying DB loggers in various catch blocks but unfortunately  Global Exception Handler do not work as every time exception occurs its handled by existing catch block . is there any way to by pass existing catch blocks and use the global one ?
5 months ago
HTTP doesn't need "broken connections". The HTTP standard is nothing but broken connections. A client makes an HTTP URL request, the server processes it, returns a response and the client/server connection is closed. End of sentence. If you want to make another request, the client must open another connection. Again. And again. And again.

A well-behaved web application will spend a minimum amount of time processing that request and returning the response. The web is not the place for long-running request/response cycles. The browser will, in fact, eventually time out and break the request on its own if a response doesn't come back soon enough.

If you need ReST (or any other HTTP request) to set off a long-running process, then you should use the HTTP request to queue up an out-of-band processor and either poll for completion (as successive periodic HTTP requests) or provide some sort of callback mechanism to notify anyone who wants to know when the long-running request is done. Email, for example.

The out-of-band processor might be some sort of batch system, but you can also spawn an engine thread(s) in your webapp ServletContextListener startup listener.

On no account should a servlet or JSP attempt to spawn threads themselves, either directly or via methods invoked by the servlet or JSP. This violates the J2EE specification and can potentially randomly crash the entire webapp server.

On the other hand, the ServletContextListener can safely spawn threads. So a servlet or JSP can use a shared synchronized resource to push processing requests to those threads.

Can JMS be a good solution here ?
10 months ago
I want to break the connection between browser and REST service immediately as soon as the client send the request and let the processing continue in background async way.
Any suggestion please.
10 months ago
Appreciate if you can suggest me how to secure REST web services exposed using Spring/Jax-rs. I would like to learn any ways to secure it excluding Spring Security.
10 months ago
Service A sitting on JBOSS want to talk to Service B on Tomcat . Here  Service B is supposed to  perform multiple operations say 4(Create a Directory,Write to a file(Few KBs) and save it to directory,Update a DB Table and send an email).

is it optimum to refactor service B in 4 small services  and trigger those 4 from Jboss ? or i should have only one service only doing 4 stuffs in one shot ?  

1 year ago
My application submits the requests to JMS queue continuously using Spring's JMSTemplate . There are chances that request is not submitted to JMS queue due to any error condition or request is submitted but not consumed successfully.
Is there any way I can keep record those cases .  I am not sure how to find which message is consumed successfully and which one is failed.

Environment - Spring . Jboss.
1 year ago

srini saitala wrote:In the below code, the line "System.out.println(sumInteger(bigs) == sumInteger(bigs));" displays as false. But when again we compare the another Integer wrapper classes "System.out.println(bc == ab);", it return true. Why the comparison of wrapper classes is false in the first case and true in the second case.

Please suggest me on this.

Why output is false -  Because the concept of intern does not apply for the int values greater than  127 - Values with less than 128 is interned in pool and same instance is returned always.
Integer i1 = 127; Integer i2 =127;
here i1==i2 will return true but it will be false with the values greater than 127 - just like given in your case which is 600.
1 year ago

Tim Holloway wrote:This can be done via OS utilities, custom applications, or a specialized application of a type called ETL (Extract, Transform, Load). Some DBMS's come with ETL tools (may be extra-cost, though). There are also general-purpose ETL tools such as Talend and Pentaho DI.

I've used Pentaho to migrate DBMS's from IBM iSeries DB2 to Linux Apache Derby, to pull tables from a Linux DB2 database and FTP to a remote analytics service in CSV form, to extract data from a timesheet system and store it in MySQL and more. It can read and write any JDBC-compliant database as well as a large number of other data sources and destinations, including Excel spreadsheets and AWS S3 cloud storage. It've also uploaded 40GB CSV files into MySQL tables. It is designed to operate with large quantities of data efficiently and can operate in parallel for greater throughput. It can even be run embedded - I've done that in a webapp. It's available in a free open-source version (in Java) and with full paid commercial support from Hitachi Corporation.

Thank you so much for such a clear explanation.
1 year ago
What is the recommended design to transfer the huge data between two heterogeneous applications sitting on different servers .  

For example one application wants to transfer the credit card transaction data from walmart to any another application which does some actions on the same data.  
1 year ago

Tim Moores wrote:Assuming the calls are legitimate, you may need to throttle the service so that no more than N requests are serviced at any one time. If there's no chance to speed up the code, you could move the service to its own server, so that it's not impacted by whatever else is going on on that server.

Can you please elaborate "you may need to throttle the service" ?
1 year ago
In web app there is a REST service  which has more than expected load on it. i.e too many requests .

This is the only service which is getting large number of hits and because of this its performance is low.

Appreciate your suggestion to handle such type of scenario.

Infra - Spring , REST, JPA , Oracle, JBOSS(cluster of 3 pool members)  
1 year ago

Tim Moores wrote:Depends on the pool. Some -like C3PO- register an MBean that your Java code can query.

In my application connection pool is maintained in Jboss. Is the C3PO applicable here ?
2 years ago