java

access to d.velop d.3 DMS web services from Java

Is there anyone having some source code in Java for accessing d.3's web services ? I got come C# code which is actually unusable since it runs inside some d.3 package and on their website there is no support for developers. Since they use WSDL I am sure I can connect to services, just need some java example not to search by myself. ...

Pattern to create class instances by integer id?

I am reading a Stream, which provides an identifier (a simple int). Depending on the int different data follows, which i need to turn into objects. So far i created classes for each object type, and each class provides a read(InputStream input)-method which reads whatever data there is to be read for that kind of object (all object class...

java.lang.OutOfMemoryError in Java

I want to login to ORKUT through a java progrram without involving IE or Firefox, I am using HTMLUnit for this in the following manner: import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput; import com.gargoylesoftware.htmlunit.htm...

Best books on JVM

Every good Java developer (well.. any developer) has his own list of the best books on each technology. Like: Core Java — "Thinking In Java" B. Eckel, "Core Java" K. Horstmann; Advanced Java — "Effective Java", "Java Puzzlers" J. Bloch; Code Style — "Code Complete" S. Mcconnell; Design Patterns — "Design Patterns: Elements of Reusable ...

LinkedBlockingQueue vs ConcurrentLinkedQueue

My question relates to this question asked earlier. In situations where I am using a queue for communication between producer and consumer threads would people generally recommend using LinkedBlockingQueue or ConcurrentLinkedQueue? What are the advantages / disadvantages of using one over the other? The main difference I can see from ...

c# client calling java axis2 web service, object "resets"

I am very new to web service stuff so please be kind. I have written a simple POJO class, and deployed it on an axis2 server: public class Database { private Project project; public void login(){ project = new Project(); project.setDescription("Hello there"); project.setName("To me"); } public Project ...

Which one of the java spring books to start?

I am currently dealing with java spring framework and i have two good books to start but i dont know which one to go first? I have beginner knowladge about spring by the way. Spring in Action Spring Recipies ...

solr translating plurals to singular, do not want it to

i have a field where there are items that are plurals, and used as very specific locators, so i do a solr search type:articles, and it translates it into : <str name="rawquerystring">type:articles type:articles type:articl it gets really frustrating, is there a way i can disable this? ...

Most efficient way to grow an array in Java?

Is there a more efficient way to grow a large array than creating a new one and copying over all the values? Like, concatenating it with a new one? What about having fixed-size arrays stored in another array and reallocate / copy that top-level one? Would that leave the actual values in place? I'm aware of ArrayList, but I need a lot o...

How to get the 'diff' between arrays in Java

I am attempting to write some test cases for some classes that involve testing the equality of two dimensional arrays of data. Here is my first stab at it: double[][] expected = { {0, 104, 0}, {145.5, 0, 0}, {83, 0, 0} }; double[][] actual = someObject.getArray(); Now, I see that JUnit does not have an 'array...

Appending multiple xml files to a single output using xsl-fo

Hi, I'm creating a PostScript file from XML input using xsl-fo (Apache-FOP). I need also to append multiple such XML to a single PS file. 1. Does Apache-FOP support appending to output? 2. if not, is there away around this issue? (concatenating the XMLs is not an option). Thanks in advance ...

Selecting MappedSuperclass from the database (Hibernate)

Problem I have a @MappedSuperclass called Data as the parent of every Entity in my database. It contains common attributes like Id etc. I then have an entity that extends Data which is also a @MappedSuperclass due to common functionality of its subclasses. The mapping in my database is correct. Here is an example of my hierarchy @Map...

Spring IoC: What about serialization?

Hi StackOverflow! I am just in the middle of the development of a new software component involving the Spring Framework. I like it but now i have a question regarding IoC and serialization. Given i have this class (Omitted imports and package declaration): public class EMailNotificationEndpoint implements NotificationEndpoint { priv...

How to download a file over HTTP and store its content in a String in Java.

I'm trying to download a file over HTTP and store its contents in a String, as the title says. My approach is thus: URL u = new URL("http://url/file.txt"); ByteArrayBuffer baf = new ByteArrayBuffer(32); InputStream in = (InputStream) u.getContent(); BufferedInputStream bis = new BufferedInputStream(in); int buffer; while((buffer = bi...

Refactoring a method which is calling others methods that throws Exception

I have several (more than 20) methods (getXXX()) that may throw an exception (a NotCalculatedException) when they are called. In another method, I need to access the results given by these methods. For the moment, I have an horrible code, which looks like: public void myMethod() { StringBuffer sb = new StringBuffer(); // Get 'f...

SQL Server JDBC: unable to create new native thread

We are using Microsoft's sqljdbc driver 1.2 in combination with Hibernate under Windows. Occasionally we are getting an OutOfMemoryError from the JDBC driver although plenty of memory is still available in the JVM heap. Here's a stack trace of the exception we are getting: java.lang.OutOfMemoryError: unable to create new native thread ...

How do I create a new packaging type for Maven?

I have a requirement to create jar files with Maven, but they need to be installed to the repository with a "foobar" extension , and it would be nice if they could have their own packaging type so we can identify those artifacts by the packaging. Can I set up a new packaging type to do this? ...

tomcat session replication - not serialized exception

Hi all, I am currently working on one messy web application. In this application there is a class which holds all the datasources. And when ever need to connect to specific datasource, method in the instance of class is called with parameter to select datasource.And class is like follows public class MyConnection implements Runnable...

How do I execute a set of goals before my Maven plugin runs?

I'm writing a Maven plugin (Mojo) that needs to execute a standard set of other plugin executions before it is run. Is there a mechanism to declare all the goals within my plugin so I don't have to rely on the user defining them all in their POM? ...

Use of \G boundary matcher in Java

Hi: I've been learning regex with java. I wanted to know if it makes sense to use \G while using java's matcher. I couldn't find any example of \G used with java :( Doing something like this would not have the same output as using \G? String a = "Pruebaprueba"; Matcher matcher = Pattern.compile("(\\w)").matcher(a); while ( matcher.find...