Java-index »» Core »

performance of BlockingQueue (again)

1132 byte By androsa at 2007-11-27 9:25:49
I'm migrating from 1.4.2 through 5.0 to 6.0, and would like to usethe Collections classes. I'm torn, tho: my current implementation usesa home-grown blocking queue where one writer and many readers process "records". The readers currently sleep for a period of time if the queue isempty. The ...

Problem with unicode

804 byte By lokisapocalypsea at 2007-11-27 9:26:03
Hello all. I am running a program that uses characters to send instructions to a machine we use here. The original version of this program was done in C but is now being ported to Java. One issue I am running into is the display of an extra character. I converted the character to an integer and ...

LDAP 636,error: unable to find valid certification path to requested target

775 byte By 4tha at 2007-11-27 9:26:36
javax.naming.CommunicationException: simple bind failed: rhein:636 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to ...

why to compute serialVersionUID with methods and constructors involved?

872 byte By joerg04a at 2007-11-27 9:26:39
I have to do some work on serialization and through my research Ifound it quite curious that the algorithm for the serialVersionUID (suid)considers methods and constructors in addition to fields. Yet, the serialization specification says methods and constructors are not involved to incompatible ...

Httpclient and url rewrite

312 byte By Suveleea at 2007-11-27 9:26:49
I am writing a java application to access a web based application using httpclient. If the server is using url rewrite mechanism, what changes do i need to do for a normal POST request? Any idea how does the browser send the request in such scenarios?Thanks in ...

Generics - re-writed version

2867 byte By franciscodiaztrepata at 2007-11-27 9:27:44
Hello all. I am building a small app that requires a persistence manager to save objects in an xml repository file.I am trying to use generics to see if I can avoid casting objects from a general super class to concrete class. Lets say Entity and Person.For a store method. I wrote this:public ...

How do you add an object to a collection typed witha wildcard?

2768 byte By dukhaa at 2007-11-27 9:28:16
Hi All,I want to add an object to a collection typed with a wildcard but I can't figure out how to do it.I've been thru the generics tutorial again and I now understand that I can't do exactly what I want to and why. However I don't know how to do it right. I copy some code below to show ...

MappedByteBuffers on 32-bit vs. 64-bit systems

3628 byte By StuThompsona at 2007-11-27 9:29:56
Hi all,In the course of performance testing and optimization of my large-file, I/O intensive application, it has become apparent that it could benefit from switching the stream-based input to a NIO MappedByteBuffer approach. The micro-benchmarks look good (5x speed improvement on read ...

convert string to code

203 byte By elmoftya at 2007-11-27 9:30:32
hi everybody if i have string of code like this "if(x == 5)y=5;"how can i convert it to real code to run in runtime ?Note: i checked Reflection API and i do not find any thing

Inserting image

96 byte By sudharsha at 2007-11-27 9:30:37
How to insert images into Database using Servlets.How we can retrive those images.

JDBC Connections

59 byte By sudharsha at 2007-11-27 9:30:44
How to connect Oracle DataBase through Java Program?

Hi

26 byte By @Aneesa at 2007-11-27 9:30:55
What is Java beans?

Upcasting to generic list doesn't work?

728 byte By justinlawlera at 2007-11-27 9:31:07
Hi, I have two obects:A extends Band two methods:public List<A> getAObjects(){return new ArrayList<A>();}andpublic List<B> getBObjects(){return getAObjects();}But I get errors in method "getBObjects()". How come? Surely I can do this cause Object A is an instance of object ...

java.lang.ClassCastException

1021 byte By manchzeka at 2007-11-27 9:31:51
Hello,I want to pass an object called UserNodeData through RMI from the server to the client.In the client side i create an object with the type of the interface of UserNodeData (the interface is called RemoteLinkman) . Here is the piece of code that make the error (client side) : RemoteLinkman ...

Active Directory Using Java

304 byte By rajeshkrishnan83a at 2007-11-27 9:32:52
Dear All,Greets for the Day.I would like to get the user details, based upon the user login.Active Directory using java.Can you please tell me how i get the details from Active directory using Java.Reply me soon.Thanks for your ...

how to feed CharsetDecoder (nio Buffer problems)

1501 byte By HolgerKa at 2007-11-27 9:32:57
Hi there,I have no idea how to feed bytes into a CharsetDecoder in presence of multibyte sequences. I am trying something along the following lines.If a multibyte char is being fed (I tried c3 +a4 = ?, the first call to decode returns UNDERFLOW with bout.hasRemaining() == false as expected, but ...

expungeStaleEntries in WeakHashMap

531 byte By nishantagrawala at 2007-11-27 9:32:58
In WeakHashMap.expungeStaleEntries method of JDK 1.5, I see following code:e = (Entry<K,V>) queue.poll()But while creating Entry, only key is added to WeakReference:Entry(K key, V value, ReferenceQueue<K> queue, int hash, Entry<K,V> next) {super(key, queue);this.value = ...

Thread wait time

367 byte By mullapudia at 2007-11-27 9:33:02
Hi all, I need to make my thread sleep after certain amount of time. There are around 30 threads running. If my thread is in waiting state for some time, i am not able to know the time how much time it has to sleep. my problem is to find how much time the current thread is in waiting state to ...

Avoiding unchecked warning

1345 byte By FabioFranchelloa at 2007-11-27 9:34:03
Hello eveyone. I'm relatively new on generics, and I'm curious about something. Consider this code:...Vector v = u.getDataVector();for (Object elem : v) { Vector<String> st = (Vector<String>)elem; if(Long.valueOf(st.elementAt(0)) == c.getId()) {// Do your things.return; }}It works ...

Using Class<?> Class.forName() generic info

361 byte By ntalamaia at 2007-11-27 9:34:15
Hi,how do I get advantage of the generic information in Class.forName method?I actually have the code:Class<?> myClass= Class.forName(myString);and I want a generic type for myClass (let T), so that later on I can create instances of myClass using:T myInstance = myClass.newInstance();How ...

Jconsole tab debugging

305 byte By MultiCorea at 2007-11-27 9:34:45
Does anyone having any suggestions on how to try and debug a plugin tab for jconsole ? I'd like to try and do this from eclipse if possible, the problem is due to having supply the jar file with jconsole instead of class files from eclipse .any suggestions would be much ...

Serialization and serial communications

2136 byte By Thomas52a at 2007-11-27 9:35:07
Hello, all. Please forgive me if this is off topic, but I could not find a better place to start. If it belongs somewhere else, please direct me and I will post it elsewhere!I am trying to deveop a bit of a device that will run connected to the ethernet. I decided to begin with Dallas-Maxim's ...

Chicken and the Egg

3217 byte By nicfortin1342a at 2007-11-27 9:35:11
I have an abstract superclass (NGEntity) and about a dozen subclasses. Each subclass implements an interface (EntityInt) as to simplify the <T extends ENtityInt> generic definition.public abstract class NGEntity{...}public class NGClient extends NGEntity implements EntityInt{public ...

Enterprise monitoring using JMX

1337 byte By pmelicia at 2007-11-27 9:36:18
Hello,So, my company has a lot of J2EE/Tomcat servers running on java 1.6. I'm trying to find a way to monitor them all via JMX from a centralized system, which would be accessible to multiple users (web based, ideally). Based on my understanding of JMX, it should be possible to extract the ...

Is it possible to know which thread created a component?

315 byte By BHARGAVAa at 2007-11-27 9:36:22
Hi,I have two thread running, one of them opened up a model dialog and waits for user interaction. Between, I got a reference to the model dialog object in my second thread and I want to know the thread name which has shown/created this component. Is is possible?thanks in advance ...

Connection reset: socket write error

1491 byte By Goela at 2007-11-27 9:36:57
My applications are Java based Client Server Applications. The clients have been developed using Java Swings API.(JDK 1.5) The Database server is Oracle 9i. The clients are connecting to server through Oracle JDBC thin drivers(classes12.jar). We are NOT using any Connection pooling.In each of ...

How to handle large amount of data

417 byte By oh_sillya at 2007-11-27 9:37:45
Hi all,I have developed a client/server application and make use of socket to send/rcv data (data size: around 12KBytes), but I found that the input stream cannot fully read the data from server and the data I got an incompleted data. What happen with the socket and did anybody got the same ...

developing a streaming HTTP client-server application in Java

821 byte By james-mcfaddena at 2007-11-27 9:38:05
hi there.this is james mcfadden. i am planning to develop a streaming HTTP client-server application in Java. i know for a fact that i would need to develop a web browser, a web server and a media player application. i would also need to create metafiles.From what i know about the streaming ...

Requests over one socket

4784 byte By Jacquipre79a at 2007-11-27 9:39:40
Hi it's me again,I tried to implement persistent connections to our project because of performance problems - as you can see some posts ago: http://forum.java.sun.com/thread.jspa?threadID=5188706&tstart=15If a request from the client (browser) is sent to our webserver, a new ...

InterruptedIOExcpetion for InputStreamReader

397 byte By mammaa at 2007-11-27 9:39:46
I am using Server socket to read from console .In the server socket , I am reading from client through InputStreamReader.In a different method, I am opening a new InputStreamReader to process the output of os command through exec().Whenever this method calls, the other InputStreamReader gets an ...

Multithreading with Socket Connection

805 byte By tech_b_ka at 2007-11-27 9:40:26
I have a code which actually runs some number of predefined threads (More than 1). The fucntionality of the thread code is to connect to another system through Socket Connections (using IP and port) and send a request to it and get back the response from that sys through DataStreams.While ...

KeyAlreadyExistsException

813 byte By michele81a at 2007-11-27 9:40:30
Hi all,I'm using a Open MBean and I have some CompositeDataSupport objects whose itemValues (the last constructor argument) could differ only because of an element, i.e.Object[] itemValues1 = {"type1", 0.d, 0.d, 0.d};Object[] itemValues2 = {"type2", 0.d, 0.d, 0.d};The problem is that when I ...

File does not exist after ftp downloading

515 byte By Lior_Levya at 2007-11-27 9:41:24
Hi all,I have a really strange problem.I'm getting a file from a remote server (ftp "get"), the process ends with no exceptions, but when I go to the specific directory where the file should have been - there is nothing there.I tried to get the file manually through acommand line ftp and it ...

Printing Image files

304 byte By Raj@SAPa at 2007-11-27 9:41:28
Dear Friends,Good Morning. Please help me in resolving the following scenario.I want to select file from particular location and send that file to the specified printer. Is it possible, can u guys throw some light on this. It will be more helpful.Thanks in ...

advice needed on how to approach this, passing around strings

1811 byte By lokiea at 2007-11-27 9:42:29
Hello everyone,I'm new to network programming and I was just wondering if I could get some clarification and some advice on networking.Right now I have a serversocket program that accepts a connection from another server that is sending large strings (events), my server socket program takes ...

what is the latest version of JMS, JMXTOOLS, JTDS and JWSDP

220 byte By mdrafia at 2007-11-27 9:42:56
Anyone please help me in knowing and downloading the latest jar files for the JMS, JMX tools, JTDS and JWSDP....Please help me in this regard...Thank you...Message was edited by: mdrafi

javax.naming.PartialResultException: Unprocessed Continuation Reference(s);

13168 byte By 4tha at 2007-11-27 9:43:39
[nobr]Hello above all to you steven ;-)I get this JNDI error performing my ldap password change:javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ''The double quote above at the end of the error msg is actually 2 single quotes just to let you ...

How to put NEW LINE char in a file..?

628 byte By pissing_crowa at 2007-11-27 9:43:46
Hi all,Am writing some data to a file using File connection. Am appending all datas to a StringBuffer and finally writes into the FileOutPutStream and flushing it. Am appending new line character ('\n') to StringBuffer and it is printing perfectly on console but not in file. In file ...

why HtmlAdaptor is so slow

724 byte By BEANSa at 2007-11-27 9:44:11
version; JDMK5, JDK5Serverside codehtmlAdaptor = new HtmlAdaptorServer();htmlAdaptor.setPort(8082);ObjectName htmlAdaptorObjectName = null;HIBServer.MBeanSvr.registerMBean(htmlAdaptor, htmlAdaptorObjectName);HIBHtml4CmdParser htmlParser = new HIBHtml4CmdParser();ObjectName parserObjName = ...

send files...please,can any one help me

5725 byte By Roddicka at 2007-11-27 9:44:33
i do a simple java chatting projecti want help in sending files between client and serverthis my client and server codehow can i change in this code to achieve this pointthanks a lot for caring//Server Classimport java.io.*;import java.net.*;import java.awt.*;import java.awt.event.*;import ...

javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: ...

5650 byte By 4tha at 2007-11-27 9:44:39
Hello,thats an image of my w2k active directory ldap tree: http://img248.imageshack.us/img248/918/adwn6.gifrunning the bottom code from Adler_Steven which i chnaged with my data i get this error message:Problem resetting password: javax.naming.NameNotFoundException: [LDAP: error code 32 - ...

jps on windows 2003

162 byte By AviralNilesha at 2007-11-27 9:45:03
I have a java app running as windows service on windows 2003. I have java 1.5_10. when i run jps i don't see that process in the list. Need help urgently.

Sorting date using Comparator.

1571 byte By beejuma at 2007-11-27 9:45:58
Hi frnds,I have a problem sorting a date using comparator Interface. To the compare method I am passing Objects, which contains values retrieved from bean.I have hyperlinks for all the fields, upon clicking am able to sort all the fields except the date:The format of date is MM/DD/YYYY. It is ...

Problem with Selector.select() NIO

825 byte By kewljavaguya at 2007-11-27 9:47:51
Are there still issues in java.nio.channels.Selector.select() when running on solaris.It perfectly works fine in windows XP. We are able to register a selector with a channel and successfully retrieve SelectionKey. But when doing a select after registration the selection key is lost (count = 0) ...

Extending HttpURLConnection

1770 byte By MarcelSa at 2007-11-27 9:48:08
Greetings,I've been using HttpURLConnection to implement WebDAV on 1.3 and 1.4 JDK. I've now upgraded to 1.6 and am no longer able to cast from sun.net.www.protocol.http.HttpURLConnection to my extension.My custom HttpURLConnection does extend the sun class and when I retrieve the ...

Returning a Remote object at client login.

4005 byte By Strider80a at 2007-11-27 9:48:12
Hello.I have the feeling that this is a basic question which might be asked more often. But strangely I didn't find this issue in the basic RMI tutorials and a google search didn't give me anything useful too.I am making a client/server program with RMI running on java 1.6.0. On the server I ...

Content-Type URLConnection

456 byte By Lizziea at 2007-11-27 9:48:25
I need to set my content type to be XML. I used the following:HttpURLConnection urlConn = null;URL u = new URL( url );urlConn = (HttpURLConnection)u.openConnection();urlConn.setDoOutput( true );urlConn.setDoInput( true ...

Downcasting a subclass of a concrete generic

5379 byte By Liam3851a at 2007-11-27 9:50:53
Hi--Been puzzling over this one for quite awhile, and I still can't figure it out. I'm trying to downcast a generic type to a subclass of a concrete type. Now admittedly that's messy and I'd like to refactor, but I'm still puzzled. Take the following code:public class Test1<T> ...

Converting a String to Date

417 byte By beejuma at 2007-11-27 9:51:11
I have a String in which i am storing the date which I have retrieved from database. How can I convert this String to a Date object and use Comparator for sorting.String strCreatedDate1 = ((CVendorEmployees) vendoremployee1).getCreatedDate().toUpperCase();The date format which I will retrieve ...

Any example of dynamic proxy with RMI?

4711 byte By eddiecjchianga at 2007-11-27 9:52:21
Hi, are there any good example of dynamic proxy with RMI, using the new RemoteObjectInvocationHandler class?I am currently implementing a Registry, and want to use dynamic proxy to wrap around the registry stub, to pass extra information to the client.I've tried it, but the program will hang ...