java

Spring 2.5 in EJB container

Hi, I would like to use the spring framework within an EJB3 project. In detail I would like to use the JDBC template class which should be instantinated from a given data source. When I put the spring.jar to my Jboss lib directoy everything is working fine. But when I put the JAR inside my EAR only there seems to be external dependencie...

How Can I create more than 14000 clients using HTTP (Tomcat) while HTTP works over TCP hence socket is created.

HTTP protocols work over TCP/IP. SO infact we can say if we connect a client then whether it is TCP or HTTP, a socket is created and hence a file is created. Tomcat works on HTTP. On TCP I can create 1024 clients simultaneously. If I create more clients then I get Too Many File Open Error. But Using Tomcat I can create more than 14000 c...

Java library\application to Build SQL Frontend GUI's

Does anyone know of a java library or application that allows for SQL front end manipulation via java GUI's e.g. Swing or SWT? I am looking for something similar to ASP .Net Datagrid, where you essentially 'plugin' the queries, set a few things up and voila! I've used Spring JDBC quite a bit and have been playing with the JDBC templa...

How to handle errors for a facade method that performs many disparate background changes ?

Imagine I have a service that looks like this: public interface MyAccountService { boolean create( String user ); } The method create performs several changes, namely (for discussion sake): adds a message into a Queue adds a row into several tables creates a LDAP account etc... Currently I collapse all the error messages into ...

How do I register a server in the default RMI registry for JBoss and access it from a client running in another JVM?

I am trying to access a Jackrabbit repository deployed on a JBoss application server via RMI. I am getting the following exception when I try to connect to the factory using ClientRepositoryFactory.getRepository('rmi://xxx.xxx.xxx.xxx:1099/imageserver'). But if I create a web application that starts a new RMI registry on the server with...

Checking contents of a map in another map in java

I need to write a small snippet of code where I need to check contents of a map (key value) if it exists in another map , remove it from the map E.g Map1: 1=>obj1 2=>obj21 3=>obj3 4=>obj4 Other map Map2: 10=>obj10 20=>obj20 2=>obj2 30=>obj30 3=>obj3 The result of fun (Map1, Map2) after it executes it has the following ouput ...

How to compile .war for Java 5/Tomcat 5.5 in Ubuntu?

I try to compile a webtools project for Java5/Tomcat 5.5 in ubuntu (with manually installed eclipse 3.4). I set the installed jre to java-1.5.0-sun-1.5.0.18 and the compiler compliance level to 1.5. When I export this to a .war file, and try to deploy it in Tomcat (Windows XP, Tomcat 5.5.27, Java 1.5.0_18) , I get the following error: ...

Java without singletons

Merely out of interrest: do you think Java would have been a better language if static variables would have been excluded, effectively replacing Singletons with singletons? Definition here. If you think so: could you elaborate on what motivation there might have been for including it in the language? ...

How to create a servlet to return a database query in a certain div

I need to create a very simple application: I need to have a form that submits data to a servlet The servlet then queries a database to retrieve a list of reports based on the criteria given by the form The returned list of documents has to displayed in a div on a .jsp page I am not sure about the last one (number 3). I know how to c...

Iceface: reset old values while update

Hello all, I have information of user in bean, and I want to update this user. but my problem is: when the value of inputtext changed I want to put validation on it. and if the new value is wrong I want to reset the old value. please can any one help me ...

Can I compile java myself ?

Is they say that sun's java is opensource now - then can I compile all the patform from sources ? I used gentoo and I found a great performance inmrovement wnen I compiled the system myself, so can it be done with java (both vm runtime and library classes ) ? Is it possible to do under windows/linux ? Did anyone do it ? Does it make ...

Is there any suggestions about cutting cpu usage in Java?

I wrote a Java program to download HTML page. But CPU usage is near to 100%, while network utilization is lower than 3%. It seems like that CPU became my bottleneck. So is there any suggestions about cutting my CPU usage. ...

Converting int to char in java

This has probably been answered else where but how do you get the character value of an int value? Specifically I'm reading a from a tcp stream and the readers .read() method returns an int. How do I get a char from this? ...

Most efficient way to read in a tcp stream in Java

I'm having to modify some client side code because the comms protocol wasn't defined properly. I'd assummed that a tcp message from the server would terminate in a new line so I used reader.readLine() to read my Data. Now I've been told that this is not the case and that instead the first 4 chars of the message are the message length a...

reusable condition/expression classes

Hi, I have needed in several occasions some classes to represent and manipulate conditions (typically in a UI so the user builds a query by combining different condition types and then the code can transform that depending on the underlying system to be queried, for example lucene and a db). I searched all over for a reusable set of cla...

Java code for getting current time

i am searching code in java for fetching or synchronising my local PC system time into my application ...

[java] call system text editor

I have Java desktop application that works with CSV files. And i want add some functionality. At this moment i need to open selected file with default system text editor. When i run my program on Windows i have no problems, just by calling notepad.exe, but what to do with *nix systems? One way of solution is to customly set the way to pr...

Start Thread with a given execution time

My main process calls an external library method. This method sometimes hangs. I can not fix the external library because another company is responsible for it. I want to use a Thread for the library calls with a defined execution timer. When the method call takes to long, the Thread with the Runnable in which the method call is placed ...

How to handle code for network failure and resume back?

suppose am in the middle of updating some information and the network connection goes off. How should i write my code to handle such situation and resume from where the code was last executing? One possible approach i could think of is to catch the exeception. and redo the logic again. While(NetworkProblem){ NetworkProblem = false; t...

Programming decision java or .Net, db or no db

Hi I am stuck while making a programming decision, I am a .Net developer, I am currently building an application for my client that receives data from a third party application, it has to then perform operations on the values and send it to a webservice/servlet which then displays data to a webpage, The catch here is that the data bein...