java

Unable to locate NamespaceHandler core

org.mule.api.lifecycle.InitialisationException: Initialisation Failure: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.mulesource.org/schema/mule/core/2.1] Offending resource: URL [file:/D:/School/EAD/CourseSVN/bart/EA3/conf/dare2date-config.xml] I know that you have to add stuff you need to mule's c...

Java String from Map of X-Y Coordinates

Hello, I have a Map where Coords is defined as so: class Coords { int x; int y; public boolean equals(Object o) { Coords c = (Coords)o; return c.x==x && c.y==y; } public Coords(int x, int y) { super(); this.x = x; this.y = y; } public int hashCode() { return new Inte...

Can someone explain "ClassCastException" in Java?

I read some articles written on "ClassCastException" but I couldn't get a good idea on that. Can someone direct me to a good article or explain it briefly. ...

How can I have my ant task pass or fail based on the results of a jar it runs?

I'm running CrossCheck (browserless js unit testing) as part of an ant script. I'd like ant to report failure if the CrossCheck tests fail. Here's the relevant bit from the build.xml <target name="test" depends="concat"> <java jar="src/test/lib/crosscheck.jar" fork="true"> <arg value="src/test/webapp/js/"/> </java> A...

Initializing an object with references without accessing a non-default constructor

Let's suppose I have an interface named "Controller". Several classes implement this interface and I don't know these classes (e.g. the class names are located in an xml-file). Now for this Controller-implementing classes to work they have to get some references to other objects (maybe data objects). And this is my question, namely what ...

Get reference to spring bean from @WebService

Hi, I'm using CXF to generate a web service from wsdl. The generated web service has the annotation @WebService How do i get a reference to spring bean from the web service? All my spring beans are annotated with @Service, and I can access them in my web application. How do I access them also from my web service? I've tried the follow...

Freeform drawing canvas (with shapes) in Java

Hello! I'm working on an GMF (RCP/EMF/GEF) application that allows users to create design diagrams. As part of that application, we have to allow the user to create their own custom shapes to add in diagrams. We are thinking of using SVG as the storage format for shapes. I'm looking for a Java library that creates such canvases and all...

Development Environment Java 6, Maven 2.x, Eclipse 3.4.x, JBoss 5 and JBoss Seam

I have to organize a development environment where I can run Maven projects with JBoss Seam, IDE eclipse 3.4.x and deploying to JBoss 5. The projects that will run on this environment are based in Java 6, EJB3 and JSF1.2. The environment has to support hot-deploy. I used to work in a development environment with Sysdeo Plugin to make To...

How to use WindowsPhotoGallery to display a gif image with Java ?

I use the following code to display a gif image in Java by calling a runtime command, it opens the WindowsPhotoGallery, but doesn't display my image, instead it shows a bunch of other pictures on my PC, my question is : how to pass the gif image file name to it properly, so it will open with my image. Now I'm passing it like this : C:\...

How do I get Eclipse to show the javadoc from my classes without including sources in the jar

I'm building jars where I want to package them without sources but I would like the javadoc to come up for developers in eclipse. ...

Java regular expression to identify strings with more digits than non-digits

How can I identify strings containing more digits than non-digits using regular expression (Pattern) in Java? Thank you. ...

How Glassfish AMX MBeans monitoring dotted names are build ?

Hello, Does anybody know how Glassfish AMX monitoring dotted names are build ? For instance for X-MonitoringDottedNames : *server.applications.__ejb_container_timer_app.ejb_jar.TimerMigrationBean.bean-pool.numthreadswaiting-upperbound=0* ? It seems that these dotted names are build algorithmically, but it beats me. PS: these can be ...

When to flush a BufferedWriter ?

Hi, In a java program (java 1.5), I have a BufferedWriter that wraps a Filewriter, and I call write() many many times... The resulting file is pretty big... Among the lines of this file, some of them are incomplete... Do I need to call flush each time I write something (but I suspect it would be inefficient) or use another method of ...

How to run my JSF 1.1 application on WAS 6.0

I face troubles accessing my website deployed on Websphere Application Server 6.0 when I deploy my application which uses JSF1.1 Runtime Environment. At first It loaded with some errors telling me that my commandLink is missing bodyContent, which is Optional, but I think edited my pages and the page is displayed. When I try to press an...

Java: new Something().method() vs a temp variable...

Hi... maybe it's dumb but is there a difference between new Something().method(); and Something tmpSomething = new Something(); tmpSomething.method(); as I was calling only one method on this particular object, I chose the first solution but I'm not sure that this is exactly the same behavior... I just want to mention the constr...

SQL sort with limit? (non trivial)

table { id: long name: string } 1235 Fred 1902 Trever 5123 George 6467 Derek 7868 Joe 8972 Bob 9272 Alf 9842 Hank I want to return 2 records prior to that of Joes, in ascending order. i.e The correct values should be: 5123 George 6467 Derek Any thoughts? FYI: Returns incorrect rows: select * from table with id<7868 order by...

Eclipse/Java code completion not working

I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ). Now I find when I'm editing Java projects the code completion is not working. If I type String. and press ctrl-space a popup shows "No Default Proposals" and the status bar at the bottom shows "No completions available"....

How to initialize Jersey with a a specific resource instance with specific MessgeBodyReaders/Writers??

I'm trying to start Jersey on a preconfigured port/url with a preconfigured resource instance. I can't quite figure out how to correctly do it. Here is a snippet of a code. Help me, please, fill in the blanks: @Component @PerRequest @Path("/svc") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.AP...

Simple regex required

I've never used regexes in my life and by jove it looks like a deep pool to dive into. Anyway, I need a regex for this pattern (AN is alphanumeric (a-z or 0-9), N is numeric (0-9) and A is alphabetic (a-z)): AN,AN,AN,AN,AN,N,N,N,N,N,N,AN,AN,AN,A,A That's five AN's, followed by six N's, followed by three AN's, followed finally by two A...

Enable/disable debugger support for the currently running JVM from Java code

Is there an interface (maybe part of JMX) that I can use to dynamically enable or disable the JVM debugger support from Java code inside that JVM? (See also http://stackoverflow.com/questions/376201/debug-a-java-application-without-starting-the-jvm-with-debug-arguments —CRM) ...