java

need help in EJB stateless beans

Hi, I am new to EJB. I have a requirement of calling a method of remote stateless bean and setting a value, before calling any method on the same bean. The value set from first method call should be available to second method. I know that a stateless bean can't hold instance variables values for next calls. Is there any alternative to m...

How do I fix this stack overflow error?

So I have what I think is pretty good code for a sudoku solver in java but I need some help with this method. It gives me a stack overflow when I embed it in a main method. The problem is that my method doesn't know how to turn around and fix its mistakes. I need a boolean flag (one that, unlike the one used in the code below, actually w...

How to do form validation using java

Please help me For the form validation using the java by interacting with the oracle database(i mean user and password validation). Thannks In advance Ram ...

Can't connect to my server when I put in my IP in Java

Okay so I'm trying to learn Java client/server stuff, and am going through the tutorial code as follows. When I change "localhost" to my ip it stops working though. Please help. Edit: "127.0.0.1" seems to work too, but not my real IP. /* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * * Redistribution and ...

Java: How to write method to accept child without casting to parent?

Not sure how to title this... So I've got three child classes of Event: WeightEvent, TimedEvent, RepEvent. Through whatever means, I get an object of one of the children. Now I want to send that child event to a method in another object so it can pull the data from it with the getSavedEvents() method. The method only exists in the child...

sql and database

Hi, I have this method in my database class.and I want to get a part of data from a column which is "dateOfBirth" in MySQL table ,but I don't know why the list.size() is "0" but when i use System.out.println() in my code it will show just the first line of sql table ,although I have two rows!!! my method: public static int getBirthP...

Maven throws "java.lang.OutOfMemoryError"

Hi, I'm compiling an open source project with "mvn install" but ended up with java.lang.OutOfMemoryError: Java heap space. I tried to execute java -Xmx256m but the output was java synopsis which indicated it's an invalid command. I'm using jdk1.5.0_08, any ideas why this is happening? Thanks, ...

Does the JVM or the underlying OS handle thread state changes

When I create a multi-threaded program and I use methods such as Wait or Signal to control threads among other things, does JVM control all the thread state changes or does the underlying OS have anything to do with it. ...

@Path regex expression in RESTful server

I'm writing a RESTful Java server with CXF framework. How do I can write a @Path Regular Expression in order to obtain any URI finished in "/action" value? ...

Client Side sorting + Hibernate Paging?

I use GWT for UI and Hibernate/Spring for buisness-layer.Following GWT widget is used to display the records.(http://collectionofdemos.appspot.com/demo/com.google.gwt.gen2.demo.scrolltable.PagingScrollTableDemo/PagingScrollTableDemo.html).I assume the sorting is done in client side. I do not retrieve the entire result set since its huge...

List<? super B> lsb = new ArrayList<A>(); Logical error in java?

We have: class A{} class B extends A{} class C extends B{} class D extends C{} we can define Lists like: List<? super B> lsb1 = new ArrayList<Object>(); //List<? super B> lsb2 = new ArrayList<Integer>();//Integer, we expect this List<? super B> lsb3 = new ArrayList<A>(); List<? super B> lsb4 = new ArrayList<B>(); //List<? super B...

Using JDWP and JVMTI to obtain information of the running Java application

We are developing an application for obtaining the information of a running java application using JDWP and JVMTI. Sun Java comes with a reference implementation of JDWP so using agentlib -jdwp: will use the reference implementation. Our aim is to study JVMTI and write JVMTI agents to get specific detail. Also creating a Front end using ...

Why won't my server and client I coded in Java work?

My server keeps getting this error when I run the client: Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) at MyServer.main(MyServer.java:10) H...

How to send email from a java web app

I have a java web application sitting on Tomcat/Apache. I have a form which has to send email. What is the best way to get this working. ...

Java: How should look an instanceof method

Hi, Imagine, I want to write a useless method called: isInstanceof that returns a boolean. I was thinking about it. But I do not get out. An instanceof has to be used like: [object] instanceof [a classname] // I was thinking about something like this public static boolean isInstanceof(Object obj, /*magic for the second param*/) { r...

Java Pass by value problem?

Hi, We know Java supports only "pass by value" .If I pass a collection for eg., a hash table to a function then the modifications to this collection inside the function should not be updated outside this function.But this is not the case in Java?.How do we conclude this? Please anyone conclude this discussion with a proof... ...

Reflowing label widget for Swing

Is there a widget for Swing that behaves like a JLabel, that automatically reflows the text if its dimensions have changed? For example: Large horizontal space available: +--------------+ | Foo bar baz | +--------------+ Small horizontal space available: +---------+ | Foo bar | | baz | +---------+ I am currently using JEditorPa...

Generating a client from WSDL.

Hi all, I was wondering if there is a (java?) API parsing a WSDL and returning a structure of the WSDL as well as a description of the schema. I know a tool like wsimport can generate the stubs for a java client but I would also like to create the graphical interfaces (java swing, html...) for sending and receiving some simple requests...

Sometimes HttpURLConnection.getInputStream executes too slowly

We have next code. Sometimes we should wait 10-20-40 seconds on the last line. What can be the problem? Java 1.4 URL url = ...; HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.connect(); OutputStream out = conn.getOutputStream(); ObjectOu...

How do I extend a wsimport-generated exception annotated with WebFault?

I'm building a web service in Java from an existing WSDL. The wsimport tool has generated all the Java classes bound to the elements in the service's schema. In particular, the fault declaration yields the following class: @javax.xml.ws.WebFault(name = "Fault", targetNamespace = "http://my.company.com/service-1") public class ServiceFau...