Category "java"

How can I make Spring WebServices log all SOAP requests?

I need all SOAP requests logged in the CommonLogFormat (see http://en.wikipedia.org/wiki/Common_Log_Format), plus the duration (the amount of time it takes to p

Maven build error after setting toolchain right

I have Java version 1.8.111 installed and the initial error message after running mvn3 install was as below. [ERROR] Failed to execute goal org.apache.maven.p

Using junit @Rule, expectCause() and hamcrest matchers

I have a test: @Rule public ExpectedException thrown = ExpectedException.none(); ... @Test public void testMethod() { final String error = "error message";

Java - SQLITE_BUSY; database file is locked

My application reads a html table and then a script (TableToCSV) converts it into a .csv format. After that I convert that .csv into a sqlite database. After th

How to convert certificate from PEM to JKS?

I have to convert a certificate in PEM format into an Java key store. To use this one with tomcat at a windows server I've got those files: cert_request.csr -

Why are static variables considered evil?

I am a Java programmer who is new to the corporate world. Recently I've developed an application using Groovy and Java. All through the code I wrote used quite

How to efficiently predict if data is compressible

I want to write a storage backend to store larger chunks of data. The data can be anything, but it is mainly binary files (images, pdfs, jar files) or text file

Convert pixel location to latitude/longitude & vise versa

I need to convert latitude longitude values into pixel positions as well as do the opposite. I've found many solutions to go from lat/lng->pixel, but can't f

Sending a screenshot (bufferedImage) over a socket in java

I am sending a bufferedImage over a socket and I am using the example found in this post: Sender BufferedImage image = ....; ImageIO.write(image, "PNG",

Hibernate not persisting enums (as String)

I'm trying to do simple thing, save with Hibernate enum value as string. My mapping looks like this: @Entity @Table(name = "CONTRACTOR") public class Contracto

Does spring @Scheduled annotated methods runs on different threads?

I have several methods annotated with @Scheduled(fixedDelay=10000). In the application context, I have this annotation-driven setup: <task:annotation-drive

no String-argument constructor/factory method to deserialize from String value

I am trying to make use of an external NYtimes API. Here is an sample example data output : { "status": "OK", "copyright": "Copyright (c) 2016 The New

How to iterate through an array list on a JSP without JSTL

//I have retrieved a Result from MySQL and created and Array-list User .i have sent this //US er Array-list in and sent it through request Response Object. Now

validate first or try catch?

Let's say I have a function that looks like this: public void saveBooking(/* some inputs */) { //save into database } Before saving into database, I have t

How to iterate Field of type List using java reflection

I have a class called User which is having List of Account class objects like this public class User{ private List<Account> accounts = new ArrayLi

Eclipse - Show generated class files

How can I show the folder (bin) where my class files are placed after I build a project in eclipse? I want this directory to show up in the package explorer. Se

Eclipse autocomplete not working

The autocomplete of eclipse is not working now and I searched for hours but I couldn't find an answer to solve it. I haven't used it for long time then the firs

package org.apache.commons.io does not exist error

I am compiling a .java file using ant compiler. I am getting the following errror "package org.apache.commons.io does not exist error" I downloaded the apache

Selenium getting error

This is my selenium test script. import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.Internet

Eclipse no longer makes import suggestions in quickfixes

eclipse isn't making import suggestions anymore. I don't know why it stopped. Here is an example.