java

How to Debug Spring NoSuchBeanDefinitionException

We have a (non-web app) Spring application that throws a NoSuchBeanDefinitionException when running tests on our CruiseControl continuous integration linux box. The test runs fine on Windows in Eclipse. The exception is thrown on the getBean() method: ApplicationContext context = new ClassPathXmlApplicationContext(CONTEXT_FILE); MyBea...

Java Mvc screencasts and tutorials?

I want to see in action howto make blog on Eclipse + Java + Mvc Framework? Do anybody see such things? ...

Java interface inheritance and implementation

I saw in the apache camel source code that public class DefaultCamelContext extends ServiceSupport implements CamelContext, Service My question is why this definition since public interface CamelContext extends Service and also public abstract class ServiceSupport implements Service Shouldn't it be just public class DefaultCam...

Creating a Temp Dir in Java

I have a test for a create DB method and I need a temp directory to put it in. The directory will be removed after the test is done. I tried using File.createTempFile(), like so: tempDir = File.createTempFile("install", "dir"); tempDir.mkdir(); But tempDir is already exists as a file. How do I create a temp directory as opposed to a f...

hibernate column name issues

@Column(name="DateOfBirth") private Date dateOfBirth; I specifically need the above code to create a column named "DateOfBirth," instead Hibernate gives me a column named date_of_birth. How can I change this? Is there a web.xml property? I came across DefaultNamingStrategy and ImprovedNamingStrategy, but not sure how to specify one ...

Setting JVM/JRE to use Windows Proxy Automatically

Hey everyone, I did see the question about setting the proxy for the JVM but what I want to ask is how one can utilize the proxy that is already configured (on Windows). Here is a demonstration of my issue: Go to your Control Panel->Java and set a proxy address. Run the following simple applet code (I'm using the E...

Debug a java application without starting the JVM with debug arguments

Normally to attach a debuger to a running jvm you would need start the jvm with arguments such as the following: > java -Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n Now if I want to debug a process that wasn't started in debug mode, what can I do? This situatoin arrises when a production system (ie started wi...

Programmatic mail-merge style data injection into existing Excel spreadsheets?

I'd like to automate data entry into Excel spreadsheets. User data will exist on a web site, and when the user requests it, that data will need to be injected into an Excel spreadsheet. The complication is that the format of the Excel spreadsheet can vary significantly between users - it'll be user defined. I've been thinking of this as...

Wait until tomcat finishes starting up

I have a script that needs to run after tomcat has finished starting up and is ready to start deploying applications. I'm using $TOMCAT_HOME/bin/startup.sh which returns immediately. How can I wait until tomcat has finished starting up? ...

What are the common undefined behaviours that Java Programmers should know about

The same as this question but for java Update Based on the comments and responses of a few people, Its clear that Java has very little undefined behaviour. So I'd like to ask as well what behaviour is not obvious. Please when answering make the disticnction between the two :) ...

'Friends' equivalent for Java?

Hi guys, having a little architectural trouble here. In C++, we have the notion of 'friends,' where such friend classes can access private members. So, I'm deving a Java app and trying to adhere to the MVC architecture. I've got a controller class that manages graph connectivity between 'map_objects.' I'd like to hide the function in t...

OpenID Java

Is there an openID implementation in Java? I would like to use this in a tomcat application. ...

Question about integrating java and flex

I have a flex web app and want to integrate it with Java. The app will have a very small database (2-3 tables), and some routine logic like sending mail. According to this link (http://learn.adobe.com/wiki/display/Flex/2b.+Code+Files), I would need to also have a .jsp file. I thought Flex would only be interested in my classes? Also, ...

Java NullPointerException when traversing a non-null recordset

Hello again - I am running a query on Sybase ASE that produces a ResultSet that I then traverse and write the contents out to a file. Sometimes, this will throw a NullPointerException, stating that the ResultSet is null. However, it will do this after printing out one or two records. Other times, with the same exact input, I will receiv...

IntelliJ Python plug-in

I've been using IntelliJ IDEA at the day job for Java development for a few weeks now. I'm really impressed with it and I'm looking to extend it for other programming languages that I tinker with, starting with Python. I found this plug-in, pythonid. I figured I would look for some input on the Stack before proceeding. First, has anyone...

Where to initialize a java Properties object?

I inherited an application which uses a java properties file to define configuration parameters such as database name. There is a class called MyAppProps that looks like this: public class MyAppProps { protected static final String PROP_FILENAME = "myapp.properties"; protected static Properties myAppProps = null; public st...

Accessing same ehcache from 2 different war files

I have 2 different webapps (package into different war files) which needs to share some data via a cache (ehcache). I want to test out this idea with you to see if it works. My idea is to create a service that bootstraps/accesses the ehcache and package that inside a jar. Then package that jar into the two wars: WAR1: ehcache-service....

Is there any way other than instanceof operator for object type comparison in java?

I remember reading in some Java book about any operator other than 'instanceof' for comparing the type hierarchy between two objects. instanceof is the most used and common. I am not able to recall clearly whether there is indeed another way of doing that or not. ...

Java Developer looking for a 2nd'ary language to play with.

What is best language to learn next to Java? Criteria for this secondary language are: High potential of being the "next big thing". e.g. If the market for Java open positions hypothetically dies/dwindles, what is the next programming language that will have a bigger market for open positions? Another way to frame this question is: If...

Java method dispatch with null argument

Why does it (apparently) make a difference whether I pass null as an argument directly, or pass an Object that I assigned the value null? Object testVal = null; test.foo(testVal); // dispatched to foo(Object) // test.foo(null); // compilation problem -> "The method foo(String) is ambiguous" public void foo(String arg) { // More-...