Java-index »» Core »

sending notification from MDB to MBean

337 byte By ajethaliaa at 2007-11-27 10:35:04
HiIs there a way I can send a notification to an MBean from an MDB? I have a MessageDrivenBean that is listening to a queue. Any message on the queue need to be fwded to the MBean.MBean and the MDB, both are in a jboss sar. The version used is 4.2.0 with java 6.Any direction would be great. Thanks ...

Differences between submit, execute, schedule

1293 byte By nichelea at 2007-11-27 10:35:10
Hi All, I have a my own ScheduledTaskExecutor that extends ScheduledThreadPoolExecutor and I have some methods to schedule some tasks in order to run it at fixed period and this work without issues.Now I have to force the execution of an already scheduled task when an event occurs (actually I'm ...

is it possible to gracefully interrupt network transaction?

1412 byte By xpantaa at 2007-11-27 10:35:24
Hi,I have this codetry{ObjectInputStream fromServer;ObjectOutputStream toServer;Wrapper.clear();toServer.writeUnshared(Wrapper);toServer.flush();try{obj = fromServer.readObject();if (obj != null) {if (obj.getClass() == Hashtable.class){tab = (Hashtable)obj;}}}catch (EOFException ...

Need Help With Collection.binarySearch ! Please help me

16478 byte By Wongwxa at 2007-11-27 10:35:59
/* * TaxPayerRecord.java * * Created on December 21, 2006, 11:42 AM * */public class TaxPayerRecord implements Comparable <TaxPayerRecord>{private String nric;private String name;private String dateOfBirth;private String gender;private String blockNo;private String unitNo;private String ...

Hmm. .. public String transform(String s){?

4737 byte By JToolTipa at 2007-11-27 10:36:06
I am trying to make an object textscripting kind of thing(based on something made by Silabsoft). How would I get this to work?public String transform(String s){while (s.contains("@")){String varString = s.substring((s.indexOf("@"))+1, s.indexOf(" ", (s.indexOf("@"))+1));try {Class clazz = ...

Newline issues in pattern detection in a string made from file contents

1674 byte By amr_ssa at 2007-11-27 10:37:06
I am reading a file into a string variable.Then I am looking for a pattern in a that string.Even though the pattern exists in the string, it is detected only if there is no newline characterat the end of the file. If i insert a newline using my editor (notepad, Window OS) at the end of the file, ...

Drawing a given number of random objects from a collection

311 byte By khandes3a at 2007-11-27 10:37:22
Is there a simple way to draw a given number of random objects from a collection in Java?The best I could come up with was...Take the collection and put it in an arraylist.shuffle the arraylistUse the first n objects.Is there an easier way that I am not thinking ...

java.lang.IllegalArgumentException; Java Textscripting Attempt

657 byte By JToolTipa at 2007-11-27 10:38:38
So I don't crowd up the post, I will post a pastebin link of the code: http://pastebin.ca/620970=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=--=-I am attempting to make a java textscripting sort of thing that will call voids. Currently, since im in a crappy stage, i have commented out parts that ...

Sockets - from LAN to online

428 byte By FortisVenalitera at 2007-11-27 10:39:10
I have worked with java for 3 years now and I just started networking yesterday. I got a fully working chat program up using sockets. It works fine between computers on a LAN but how do I get it to connect via the internet? InetAddress.getLocalHost() returns my LAN IP, and over the internet, socket ...

Inputstream limitation?

1494 byte By kenneth-rocka at 2007-11-27 10:39:31
hi. i have a server in java and a C# client. they are communicating through sockets. however when i tried to sent to send a image (a few mb) the server would only received 7300 bytes. some parts from my codesint servPort= 3333;ServerSocketservSock= new ServerSocket(servPort);int i= 0;byte[] ...

how to add new Field and new getter/setter methods to a class object

430 byte By yogeshCAa at 2007-11-27 10:39:32
hi alli have one scenario where new table gets created run time, where the columns of that table and data type of the columns can be configured by user.I have to create DTO, referencing this new table.So is it possible to add new fields and getter setter methods of that fields to be created in the ...

Not able to get information of trusted domain user which is member

2910 byte By Abhijit_Ma at 2007-11-27 10:40:01
import javax.naming.ldap.*;import javax.naming.directory.*;import javax.naming.*;import javax.naming.directory.BasicAttributes;import java.util.Properties;public class test {public static void main(String[] args) {Properties env = new Properties();env.put(Context.INITIAL_CONTEXT_FACTORY, ...

RMI, you are my Everest !

2038 byte By NoRationalSolutiona at 2007-11-27 10:40:12
Hello,I'm a student and I'm new to networking in java. For the purposes of my project RMI seems to be an ideal solution, whats more I really want to master what looks like a powerful tool.Below I will post 3 classes and the code which i use to compile the main one. If its not to much trouble ...

HttpServer - establishing connection state

465 byte By laryya at 2007-11-27 10:40:24
Hi,I'm writing a simple app which uses com.sun.net.httpserver.HttpServer. Handling single requests involves opening some ui dialogs - at this point everything is ok. Problem starts when the client closes connection before the response is formed. Unfortunately I cannot know about that before trying ...

file not found Error

2245 byte By bunty4ua at 2007-11-27 10:41:01
Hi everybody I am doing small program to read the content's of file from the local PC using URL class. I have written the following code but i am getting the error as "file not found". can anybody help me to solve this problem. how to give the path of the file to URL class constructor to read the ...

Last Modified date of a remote JSP file - URGENT

680 byte By arunkumar504a at 2007-11-27 10:41:06
Hi All,I am getting the last Modified Date for all types (.html, .txt etc.) of remote files except JSP file. Here is the code I am using:URL url=new URL(" http://www.mysite.com/index.html");URLConnection uc=url.openConnection();Date d=new Date(uc.getLastModified());System.out.println(d);Only for JSP ...

JProfiler on Console

209 byte By Ahmadysa at 2007-11-27 10:42:00
<p>Hi,</p><p>I need to install and run JProfiler on a console environment to act as the server for remote profiling, is this possible? (Console thing)</p><p>and if it is, how could it be done?</p><p>Thanks</p>

JMXMPConnectorServer stops accepting after AccessControlException

1502 byte By j.w.sa at 2007-11-27 10:42:38
Hi,I have an application managed by JMX using the JMXMP connector (Java 1.5). I am restricting which hosts are allowed to manage this application by using java.net.SocketPermission entires in a security policy file.Attempting to connect to the application from a host which does not have the allowed ...

Multiple APIs

197 byte By Chocolatemana at 2007-11-27 10:42:39
<p>If I have mutliple APIs in different directories, but have a project that needs classes from both APIs, could I simply copy documents from one API into the other? Or is there another method?</p>

Defining return values of the same class in interface implementations

3593 byte By itemStateChangeda at 2007-11-27 10:42:52
hello,i'm trying to update older code to java 1.5 using generics. i'm new to generics and i have a problem i cannot solve: assuming the interfacepublic interface Stake{public Stake makeACopyAndShift( long delta );}and the classpublic class BasicStake{private final long pos;public BasicStake( long ...

Multicast issue

359 byte By nichelea at 2007-11-27 10:43:16
Hi All,I would like to know some idea to resolve this issue about UDP in a easy way (if it exists)....Basically I have a process that publishes some UDP multicast packages and many process that read such packages. Every packages represent a request for a "work" and I would that just one "reader" ...

Sending Files over a Windows Network

302 byte By punkrawk0568a at 2007-11-27 10:43:19
I am trying to send files from one computer to the other over a windows network. I have absolute path names of the two locations. Can you just use "File.renameTo(File);" to pull this off? Is there a fast way to move files over a windows network? Thanks so much for your ...

Directory Search using FilenameFilter

302 byte By dondragon2a at 2007-11-27 10:43:34
I have a directory that has over 100,000 files in the following format:Invoice-100010001-16072007.xlsInvoice-100010001-16072007.pdfI want to be able to find all files with a certain name (ie Invoice-100010001).Is it possible to use a FilenameFilter to implement ...

What collection to use?

9706 byte By RockmanEXEa at 2007-11-27 10:43:43
From my GUI press "Used Phone Acquisition" when enter is pressed the data will be saved and return to "select option".Am i going to use queue or vector? and how to add tf1.setText(""); to EventHandler Cancel and Cancel2 to terminate data entry.import java.awt.*;import java.awt.event.*;import ...

Trouble Connecting MS Exchange

1845 byte By SaschaJanza at 2007-11-27 10:43:52
hi,i got the following error message when i try to connect to an ms exchange server. javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece; remaining name ...

Serialization error when client app on JDK1.6 access WebLogic on JDK1.5

4255 byte By dannyju@yahooa at 2007-11-27 10:45:04
I have a client application running on JDK1.6 and trying to connect to a JMX running on Weblogic 9.2 server with JDK1.5.0_06.An exception was thrown on client side when processing return from JMX server, the most relevant exception seems to be:Caused by: java.rmi.UnmarshalException: failed to ...

Char array not creating String Object

512 byte By Java_Knight_123a at 2007-11-27 10:45:13
Hi,I am getting a char[] after executing a DB Stored Proc from Sybase DB . But the value returned is Cha [] instead of String. I understand that string and char[] are same . but that is not the case . When I try to display the string in JTextarea it does not honor the \n . Slso the spilt method of ...

Authentication through Active Directory

459 byte By hsy541a at 2007-11-27 10:46:11
I'm an entirely newbie about the LDAPI want to setup a openfire server using LDAP authentication on my client machine while i do not know what does base DN mean and can not pass the connection test. There always comes a error message saying "[LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, ...

Run() and start()

3276 byte By MikeM64a at 2007-11-27 10:46:16
Hi,I am refining a program I made in school (Mandelbrot) to make it threaded. Currently everything hangs on one thread and the program locks (spinning beachball of death - mac) until the program has finished calculating the image. I am trying to add just one more thread so that the interface does ...

Excel file reading project

999 byte By technogeeka at 2007-11-27 10:46:43
Hi, I am new here and just finished AP Computer Science learning Java. I am now doing a little programming project for my brother. He is giving me a folder with spreadsheets. I should be able to detect if he has added new spreadsheets. I have figured out the logic of the program (except how to ...

How to set socket proxy in NIO?

497 byte By MaoZedonga at 2007-11-27 10:47:15
How to use socket proxy in NIO?Our socket Server program is hinding a firewall, so our client have to use a socket proxy to visit server.We can set socket proxy by using block socket as ...

ReentrantReadWriteLock understanding

2347 byte By bb1234a at 2007-11-27 10:47:19
Hi,I am studying the mechanism of readLock() and writeLock() but is still hazy on them even read through the java.util.concurrent.locks API doc many times. I have encountered the following questions:1. As I know the writeLock() is actually holding up a lock whereas readLock() doesn't; so why not ...

to add elements and to retrieve them

411 byte By brittle_bonda at 2007-11-27 10:48:07
i want to add d elements to d arraylist in init method and then retrieve its value in in paint methodhow can i do tht?Label one;ArrayList a= new ArrayList();public void init(){a.add(20);one = new Label("hi"]);add(one);}public void paint(Graphics g){one.setLocation(a.get(0),a.get(0)); // also an ...

Malformed URL error when using 'temp_client@domain.com' FTP user name

1048 byte By shookstera at 2007-11-27 10:48:18
I've got a very quick question for you guys.I've been testing a simple FTP upload program and I tested it with my main FTP account and it worked fine.URL url = new URL("ftp://user:pass@ftp.domain.com/" + inputFile.getName());I've now set up an new FTP account with my hosting provider and ...

Path of directory on solaris

492 byte By GauravDeva at 2007-11-27 10:48:22
HiHow can i format the file path string which would be machine independent? The code shown below works perfectly well in windows JVM, but iam worried whether the same code will also work on solaris?String hostIp="";try{hostIp = InetAddress.getLocalHost().getHostAddress();String path1 = "\\" + "\\" ...

jdbc and multiple thread

1011 byte By rinoa_fftsya at 2007-11-27 10:48:23
hi, i have an application that creates multiple thread..each thread (querythread) is accessing a webservice(querydb) that retrieves data from different databases. This webservice supposed to create a jdbc connection each time it is invoke by the querythread. The problem is i get an error that a ...

(beginner) return types of an MBean

1662 byte By garedunorda at 2007-11-27 10:48:54
I have an MBean interface which looks like this:interface MyMBean{Host getHost( String name );}interface Host{Integer getId();// ... other methods}On the server side, the implementation definesclass HostImpl implements Host{...}class MyMBeanImpl implements MyMBean{public Host getHost( String name ...

Is swings comes under core/Advanced

174 byte By YShashidhara at 2007-11-27 10:49:01
<p>Hi all,</p><p>Iam getting confused with swings whether it fits under core java or Advanced Java. Can any body help me...?</p><p>Thanks & Regards</p><p>Shashidhar Y</p>

Ranges

511 byte By zohar.amira at 2007-11-27 10:50:13
Hi,I'm looking for a way to keep ranges. I have objects which have an effect over a certain time interval. Some objects' effects may overlap others. I need a way of adding objects and their ranges and then asking for all resulting intervals.For example, if I have:add(A, 2, 10)add(B, 3, 7)Then I ...

Use of annotations

207 byte By ceilingfisha at 2007-11-27 10:50:53
<p>Hi,</p><p>I have been using Java 5 for a while now and haven't ever really seen what use annotations for. Does anyone have any good examples of what they can be used for?</p><p>Many thanks,</p><p>Tom</p>

Problem connecting JDK1.5 JMX server with JDK1.6 client

4261 byte By dannyju@yahooa at 2007-11-27 10:51:41
I have a JMX client application running on JDK1.6 and trying to connect to a JMX server running on Weblogic 9.2 server with JDK1.5.0_06.An exception was thrown on client side when processing return from JMX server, the most relevant exception seems to be:Caused by: java.rmi.UnmarshalException: ...

HashMap needs unchecked conversion to conform to HashMap<String, BigDecimal>

989 byte By robpaynea at 2007-11-27 10:52:10
Type safety: The expression of type HashMap needs unchecked conversion to conform to HashMap<String,BigDecimal>Sorry about the topic but thats all the characters I could fit.So I'm trying to make sure all the new code I'm producing these days uses generics, because they're cool and casting ...

Java Webservice Windows Domain Authentication

255 byte By Sooty1982a at 2007-11-27 10:52:55
<p>I'm testing against a webservice that is written in CSharp which requires a windows domain login. I have a java client which consumes it, but I can't workout how java authenticates on a windows doman? Can anyone lend a hand.</p><p>Thanks, Daniel.</p>

JVM crashes on Windows 2003 server

326 byte By jobina at 2007-11-27 10:53:30
HI I am running my java application program on Windows 2003 server. with the jre 1.4.2_03. but some how my java.exe gettting closed coz JVM crashes.is it b'coz of the jre version conflict with Windows 2003 server?is it a bug of jre1.4.2_03?Plese help mewith regrads Jobin ...

Reading or parsing windows event file like event viewer

1890 byte By yogeshjoshijia at 2007-11-27 10:53:40
hi ,any one can help ,me to solve my problem.i m talking about reading AppEvent.evt SecEvent.evt SysEvent.evt fileswhich basically resides in C:\WINDOWS\system32\config folder ofwindows xp.if we want to open that files and our computer is on n/wthan some services used all three files and i m not ...

disk memory status?

115 byte By Weasela at 2007-11-27 10:53:58
<p>Is it meanwhile possible to get information about the free memory / space value of an addressed disk medium?</p>

jndi lookup for Active Directory 2003 server

1962 byte By vibhor.jain.1210a at 2007-11-27 10:54:01
Hi,I am facing a problem while searching for the members of the group (where group name is in arabic) in active directory 2003 server. The ldap URL through which I am looking up is :ldap://192.168.5.237:389/CN=<group name in arabic>,CN=Users,DC=boston,DC=usSearch string is : objectClass=*The ...

HttpURLConnection how to connect url

591 byte By javaskilleda at 2007-11-27 10:54:21
hi all in first I'm using jsp and need connect into jsp the url without redirect the jsp in simple need take httprequest without redirect URL url=new URL("the url need send request");HttpURLConnection ...

call a function whose name will not be known before run time

94 byte By amitrana83a at 2007-11-27 10:54:31
<p>how can i make a call to a function whose name will not be known to me before run time.</p>

Can I register my own MBean by JVM built-in MBeans?

328 byte By dash_huana at 2007-11-27 10:54:48
Hi!I'm looking for a way to run my own MBean with JVM, just like how the JVM built-in MBeans run in JVM (you don't have to call them in your java program, but only set the JVM parameter -Dcom.sun.management.jmxremote). Is there a mechanism to register my own MBean by the built-in MBeans?Thank ...