Java-index »» Core »

Socket, thread and Corrupted ObjectInputStream

6982 byte By Voldora at 2007-11-27 8:40:27
Hello,i'm trying to implement a client/server code where the clients can send serialized Objects while reading incoming ones from a server.To simplify the example i only serialize String (But i plan to serailze more complez object, so i want to use Object serialisation)here is what i've ...

Chat prob..

546 byte By Reona at 2007-11-27 8:40:28
I created a program for chat using rmi..I extends UnicastRemoteObject in both server and client sides...And after compliling the server is running smoothly but client is holding the following errors...error:java.rmi.ServerException: RemoteException occurred in server thread; nested exception ...

Error SocketChannel receive multiple messages at once?

4459 byte By javaweirda at 2007-11-27 8:40:45
Hello,I use Java NIO, non blocking for my client-server program.Everything works ok, until there are many clients that sending messages at the same time to the server.The server can identify all the clients, and begin reading, but the reading of those multiple clients are always the same ...

Possible causes for memory leak in Java and Tomcat

128 byte By khifaa at 2007-11-27 8:41:19
I would like to enquire what are the typical mistakes done by programmers that will cause memory leak in Java and Tomcat.

Get method in the Attribute class. in JNDI

464 byte By AdrianHBKa at 2007-11-27 8:41:21
I had connected to the AD // Create the initial directory contextDirContext ctx = new InitialDirContext(env);Attributes attrs = ctx.getAttribute("DC=DomainDnsZones,DC=testing,DC=local");but I had no idea wat to get from the attrs.get method.as in, I don't know what kind of attributes ID are ...

Managing Multiple threads accessing a single instance of a class

1919 byte By kittykat13a at 2007-11-27 8:41:50
Hi,i have to redesign a class, say X, in such a way that i manage multiple threads accessing a single instance of the class, we cannot create multiple instances of X. The class looks like this:Class X{boolean isACalled=false;boolean isInitCalled=false;boolean ...

exception handling

3152 byte By noobs_will_rulea at 2007-11-27 8:42:13
i have a datagram client which checks how many servers are alive on the network now i get these two excpetions "help "datagramsocket is the name of main() class>at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)>at ...

Doing what netcat does

547 byte By sri1025a at 2007-11-27 8:42:37
Hi,There's an application that is pushing some data to my local computer on some port, say 6666. I am using netcat to read from this port and I'm pushing this data into a file.like:-$ nc -l -p 6666 > output.txtNow I want to do what netcat is doing in Java, that is read from port 6666 and ...

Communication b/w C and Java thru Socket programming

382 byte By snehaa at 2007-11-27 8:42:52
Hi All,I've to write code which communicates between java code and C code through Socket programming. I've to read some information given by C program and to show that information through a Java GUI application. So I need to use Socket programming for that.Can anyone suggest how is it ...

TCP/IP Framework

236 byte By RooKeea at 2007-11-27 8:42:54
Hello,I plan to develop a multithreading tcp/ip server. But it is necessary to use the SocketServer and Socket class? Does anybody know a nice framework that support developing a network server?regards,Rookee

Serialize and Deserialize

935 byte By giovinazzoa at 2007-11-27 8:43:15
Serialize and Deserialize with Oracle 9 and Oracle 10We have developed a client/server application. Client is a Java application and Server is written in C-Language; link between Java and C is RPC/JRPC.We have to serialize and then deserialize a stream in a clob field in Oracle DB. When we ...

UnMarshallException, ClassNotFoundException: HelloImpl_Stub

2265 byte By kayala at 2007-11-27 8:43:41
Hi friends,I wrote a small HelloWorld application using RMI. I listed all the files below.Hello.javaimport java.rmi.*;public interface Hello extends Remote {public abstract String sayHello() throws RemoteException;}HelloImpl.javaimport java.rmi.RemoteException;public class HelloImpl implements ...

Class

119 byte By kalpanava at 2007-11-27 8:43:44
Emp e=new Emp();Class.forName("Emp").newInstance();can anyone explain the diff b/w two statements?

How to copy a file from jar to disk

386 byte By S1lv3ra at 2007-11-27 8:43:55
Hey guyz,I have a client application that uses a wordprocessor. it needs a binary file in a folder e.g. c:/emp/processor/the file is in my jar and i want to copy it to the location c:/temp/processor/I loooked all over the net but could not find a *** thing. The question is. How do i copy a file ...

connection reset by peer when I specify port for Callback

1250 byte By hellscreama at 2007-11-27 8:44:56
I have a successful rmi callback when it uses annoymous port by using UnicastRemoteObject.exportObject(this) from client. But I get the following messages when I tried to specify port by using UnicastRemoteObject.exportObject(this, port) by client. My understanding is this tells the server to ...

Multithreading ConcurrentHashMap and Lists

3488 byte By angeshwara at 2007-11-27 8:45:04
Hello all,I apologise for re-posting.I have a data structure as followsConcurrentHashMap<String, Object>The Object corresponds to 3 listsList<Long>, List<Long>, List<Long>These long's correspond to file pointer positionsand the string is a file name.i.e. each file has a ...

get image from a url using InputStream issues

2471 byte By Samantha at 2007-11-27 8:46:17
Hi, I am trying to an image from an URL. I am able to get the image but the image is damaged. my code looks as follows. public static byte[] getImage(String imageURL){byte[] blob=null;if (imageURL!=null&&(imageURL=imageURL.trim()).length()>0){InputStream ...

Stub/Exported object/Exportee lifecycle

2768 byte By _dnoyeBa at 2007-11-27 8:47:30
When I export an object it creates a stub. I am wondering what is the lifetime of this stub. or more specifically, what is the lifetime of an exported object.It seems that if a client calls a method, and in that method I export an object, but I do not hold that object locally, and I do not pass ...

Type checking in a method with generic parameters

1778 byte By jGarya at 2007-11-27 8:47:51
public class Utils {public static <T> void CopyToGeneric(Collection f, Collection<T> t) throws ClassCastException {if(f != null && t != null) for (Object o : f) t.add((T)o);}}... list = new ArrayList();list.add(new Integer(1));list.add("qqq");listOfStrings = new ...

Help in using client certificate authentication

2099 byte By jennforda at 2007-11-27 8:48:01
Hello all,I have been working on a problem for quite some time now with no luck.I am writing a client to a web service from an outside vendor. The vendor is a certificate authority, although a non-standard one for sure, and they supply certificates for many applications in my industry. ...

determing the socket factory currently used

304 byte By eddiecjchianga at 2007-11-27 8:48:40
Hi all, On the server side, there are 2 different socket factories being used:SSL server/client socket factory on port 3000server/client socket factory on port 1099When a request comes in, can we determine the type of socket factory being used?Thanks in ...

sort method of Arrays class shows a unchecked warning

979 byte By durgakbea at 2007-11-27 8:49:08
HI ,I am calling the method "sort(T[] ts, java.util.Comparator<? super T> comparator)" of Arrays class. I have overriden the comparator class called MyComparator with the following declaration.public class MyComparator<C extends Charge> extends DefaultChargeComparator {public static ...

Connection timeout

309 byte By Kilwcha at 2007-11-27 8:49:48
Hello,I know there is a way to set a way to set read timeout (sockect.setSoTimeout() called before sockect.getInputStream() and inpustream.read() ), but I would like to know if there were a Java way to set connection timeout (by any mean : API, properties, system/JVM properties) ...

annotations' inheritance, polymorphism, 'cycle detected' limitations are...

2942 byte By upperdownera at 2007-11-27 8:50:17
... giving me a headache.Hi all,What I would like to do is specify access rights on some methods, like so:@Or({@Role("Administrator"), @Role("Engineer")})public void someMethod();This reads like "all persons having the administrator role or the Engineer role have access to the someMethod() ...

OBEX: problems with get()

6862 byte By ouendana at 2007-11-27 8:50:46
Hi, I'm coding a server-client app. The server is on a PC, and the client on a mobile phone. I want to transfer some files from the PC to the mobile phone, using obex get function. This is the code that I have:Server:public void run() ...

Select RMI or other libraries

504 byte By ViktorSa at 2007-11-27 8:50:51
I am writing an application that has a server and a lot of clients. Clients and the server send messages to each other. I am going to use RMI, but:1. I will have 1000 requests from clients to the server per second. Is it normal for RMI? How about performance?2. I know there are many different ...

RMI method invocation leading to Memory Leak

657 byte By vijshettya at 2007-11-27 8:51:42
My application uses RMI for communicating between two java processes.I'm observing some kind of memory leak in one of the classes in RMIlibrary. When observed through OptimizeIT, I see a large number ofObject[] being created by the ClassDefiner.defineClass() &ClassDefiner$1().run().These ...

Persistent Connections

2490 byte By jacquiprea at 2007-11-27 8:51:46
Hi everybody,I'm new here and I'm also a newbie in this topic: Java networking. So I have a question to you, because I didn't find a solution in this forum. If there is already posted one, I'm sorry for opening a new thread - maybe you can link the answer to me :-)So, here is my problem:I ...

Multiple HashMap Problem.

281 byte By uzairbaig@msn.coma at 2007-11-27 8:52:40
Hi All,I have 2 HashMaps in my Class. I execute query fetch the data from data base and put it on HashMap 1. Then i execute another query and fetch the data and put it on HashMap 2. But the HashMap 2 also update HashMap 1. I dont know why it is happening.Uzair

Connection refused !!

835 byte By gyll35a at 2007-11-27 8:52:49
Hello,a collegue developped a standalone program. It's a client RMI. It works fine !I need this program to add it in my webapp. But an exception is thrown :java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refusedat ...

Interface xyz is not visible from class loader

2758 byte By rapthora at 2007-11-27 8:52:59
Hello,I have some Spring webapp that uses a controller to access some service object within a shared lib in Tomat. The shared lib provides service classes that are transactionized with Hibernate's TransactionManager. However, when trying to persist some Hibernate entity I get the following ...

Cannot cast to custom interface

3870 byte By tufia at 2007-11-27 8:53:21
Hi, i've been dealing with a problem for a few days. Hope someone can help me. The situation:I want to visualise different types of sorting allgorithms (bubble sort, quick sort etc.) The program has to be modular. So, every algorithm implemets my custom interface SortModule. The algorithms ...

Validate userPassword

432 byte By evelinea at 2007-11-27 8:53:47
Hi,for my web application I have to validate the user login (username and userPassword). The user-object is stored in the MS Active Directory . Now I want to use LDAP with the JNDI to compare the login values. In ADS it is not possible to read the entry of the attribute 搖serPassword? How can I ...

Reflections: What am I doing wrong here?

1332 byte By cvweiss__a at 2007-11-27 8:53:48
Given the object:public class TestObject{public Object[] oArray;public int[] iArray;}and the codeTestObject to = new TestObject();Field objectArrayField = to.getClass().getField("oArray");Object oArray = Array.newInstance(objectArrayField.getType(), 0);objectArrayField.set(to, oArray);Field ...

HttpURLConnection setChunkedStreamingMode() and SocketTimeoutException's

1361 byte By kpmga at 2007-11-27 8:53:59
Hi All,We have a WebSphere/Java application that uses a file management applet on client machines. We encountered a frustrating upload limit of about 40 MB and found that the applet was throwing an OutOfMemory error. We've come across the HTTPURLConnection setChunckedStreamingMode() method ...

highly threaded connection bottleneck

1999 byte By dew2hirooa at 2007-11-27 8:54:54
i'd like to understand the general flow control wheni assign a unique InetAddress to each of 256 threads andthen launch all 256 Thread simutaneosly.each Thread tries to make a java.sql.Connection withthe InetAddress that has been assigned to it.so:(1) when no connection is attempted, the ...

Can somebdoy explain the output for this program?

1017 byte By harsha_ava at 2007-11-27 8:55:31
Why is the value in the following program being read as 255 instead of -1 ?The intent behind this program was to check whether the FileInputStream would be able to read -1 from the file, which btw is also the return value of read() when EOF is reached.import java.io.IOException;import ...

starter question about RMI

463 byte By nthalia at 2007-11-27 8:55:42
Hi all,I'm embarrassed to admit it, but i have been doing a little bit of RMI on and off for probably 5 years, and don't have my basics clear on it.When I start an RMI server that i have implemented, how does it know where the RMI registry is? for instance, how does it know if the RMI ...

Understanding wait()

2919 byte By aria_kokoschkaa at 2007-11-27 8:56:26
Hi,I am a bit confused as how wait() actually works. I know the purpose of this method but what I wanted to know is when a few threads waiting on a certain object lock and they are signaled via notifyAll(), how does one of the threads on the waiting list for that object lock gets the lock and ...

Posting file with ClientHTTPConnection

785 byte By Turennea at 2007-11-27 8:57:02
Hi,I have been trying to upload a file using the HTTP post method for, and the ClientHTTPRequest class made available on the web at: http://www.devx.com/Java/Article/17679/0/page/3by its author, for more than a day. I am calling post, but the file is not being posted. The file should, according ...

How to add an extra Attribute LDAP?

136 byte By netjagana at 2007-11-27 8:57:14
My project requries a extra Attribute in LDAP ... i need to add this attribute for all the users .. how to do it ... help me out.

file transfer through http

10261 byte By Holoda at 2007-11-27 8:57:24
I have a java desktop application.It has to get file through httpIt gets jar file.Please, see my SSCCE:import java.io.BufferedInputStream;import java.io.BufferedReader;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import ...

Length of double valuye

1495 byte By RajeshKandhasamya at 2007-11-27 8:57:30
Hi,How to identify the length of doouble valueI am getting the double value like below 123456789123456789123456789123456789.22446688I need to find the length of this double value.I have tried the following ways:1)Pretty ordinary way, just converted the incoming value to String and find the ...

Want to create object on the fly

483 byte By Indranil.Sarkara at 2007-11-27 8:57:41
I want to create object of any defined type.Suppose I have got to create object of class "MyClass" and constructor values like int, string.This creation has to be dynamic in nature , meant , the class or constructor params can be had with any changing valuesExample : I call a method where I am ...

Anonymous Communication Client-Server

891 byte By Darius_IIa at 2007-11-27 8:58:02
I need some urgent help....What socket should i use and how can i change the sender's ip address? I need this for my graduation thesis practical part, for a client who can send packets to a server and viceversa, without awearness of the server where from the packets arrive (if they addr is not ...

Unable to install JDK 1.4.2 - JNLP file is not recognised.

292 byte By spartan757a at 2007-11-27 8:58:04
Hello Friends, I try to install JDK 1.4.2_08. the JNLP file type is not recognized by my system. I have windows XP professional. but its fine with 1.6x JDK. but I need to install 1.4.2_08 for using SAP Netweaver platform.Ur help wud be gr8ful.Cheers,Senthil

I Can't create and add en entry in Ldap using Java

6536 byte By samdanna at 2007-11-27 8:58:25
Hello there, I'm pretty new to LDAP programming, and I have been trying to create and add an entry to a directory using the code sample provided in the JNDI tutorial, but for some reasons, I didn't manage.the configuration file is well set up because I can't create, add, delete and modify ...

Starting / stopping a context using JMX with Tomcat

824 byte By syg6a at 2007-11-27 8:58:53
Hello,Tomcat 6 (as well as 5) has built-in support for JMX for administering Tomcat servers. I would like to be able to start and stop a context on a given host.I've been going about it like this:I create a JMXServiceURL, create a JMXConnector and with it I create a MBeanServerConnection ...

Losing unprocessed records when blocking queue entries are serialized

879 byte By hiteshbagchia at 2007-11-27 8:59:41
Hi,I am developing a batch framework using the Java 1.5 thread APIs. We have a requirement to save the state of the batch processes when it terminates abnormally or when it is killed for any reason. I have implemented this functionality using shutdown hooks. I have initialized the thread pool ...

Buffering Network Connections

1621 byte By geffdea at 2007-11-27 9:00:15
I am building two applications (well, one application and one applet) that communicate over a network using TCP. The application, which is the server, is continually spitting out data from a sensor every 10 ms. The applet is receiving these data by reading through a buffered reader and graphing ...