java

How to validate an XML document using a RELAX NG schema and JAXP?

I would like to validate XML documents using RELAX NG schemata, and I would like to use the JAXP validation API. From Googling around, it appeared that I could use Jing and the ISO RELAX JARV to JAXP Bridge. Unfortunately, after adding both to my classpath, I can't get it to work. SchemaFactory is just throwing an IllegalArgumentExcepti...

enums and generic methods in java

Hi all, I still have trouble with some corner cases in the java generics system. I have this method (I'm only interested in the signature) : interface Extractor<RETURN_TYPE> { public <U extends Enum<U>> RETURN_TYPE extractEnum(final Class<U> enumType); } (think about an interface whose implementations sometimes extracts an En...

Webservice Read Timeout

All, I am calling a web service deployed on jboss using java annotations (javax.jws.web*) exposing a single method. In my web.xml I have the following code appended before the end of the webapp <session-config> <session-timeout>0</session-timeout> </session-config> I am wanting to the web service to wait and receive a response but...

JPanel doesnt display the drawing

I have problem displaying drawing on JPanel. I created three class which linked to each other as the following. I was wondering why this code, doesn't display my drawing. c.add(pDraw); pDraw.add(draw); 1) MAIN public class mainPage { public static void main(String[]args){ JFrame appFrame = new Frame(); appFrame.setVis...

java rmi authentication & security. exportObject makes it public?

The Question: When you UnicastRemoteObject.exportObject(instance). Does that instance now become publicly available to all clients. Even if a little tricky is required to find its port. This is the situation: I have a java RMI client/server setup and I wanted to add some authentication. Allowing the client to user a user/pass combo b...

A .net wrapper for Google App Engine?

Does anyone know of a .net wrapper around either python or java Google App Engine services? Any help appreciated // :) ...

Is it possible to use placeholder in context.xml

I'm using Spring and struts and have the following entry in '/META-INF/context.xml' <Context cachingAllowed="false" useHttpOnly="true"> <Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="100" maxIdle="30" maxWait="10000" ...

Trigger to Repaint nth Row In JList

May I know know I can trigger system to repaint nth row in JList? Currently, what I did is jList0.repaint(); // Repaint entire JList, which is not efficient. I am only interested to update nth row in JList. Please note that the reason I want to do so, is that I install a custom list cell renderer. The GUI look of the list, will de...

Problems with createImage(int width, int height)

I have the following code, which is run every 10ms as part of a game: private void gameRender() { if(dbImage == null) { //createImage() returns null if GraphicsEnvironment.isHeadless() //returns true. (java.awt.GraphicsEnvironment) dbImage = createImage(PWIDTH, PHEIGHT); if(dbImage == null) ...

Java5 on Snow Leopard

Hi, I need Java5 (not 6), but Snow Leopard comes with only Java6. There is /System/Library/Frameworks/JavaVM.framework/Versions/1.5, but that just points to 1.6.0: $ ls -la /System/Library/Frameworks/JavaVM.framework/Versions/ lrwxr-xr-x 1 root wheel 5 Sep 24 20:12 1.3 -> 1.3.1 drwxr-xr-x 3 root wheel 102 Jul 21 07:35 1.3....

How would you write your own Java classes to inherit from both JFC and WFC classes?

As we all know "multiple inheritance" is prohibited in Java and J#. However, you can implement multiple interfaces like Runnable using Java and J#. So, how would you write your own classes to inherit from both JFC and WFC classes, and implement both JFC and WFC interfaces at the same time ? Is something like that possible......? I know...

Tools for generating a control flow graph from source code.

I need a tool to generate a control flow graph from java source code. Are there such tools available? Is there a possibility to also generate source code if I have a control flow graph? ...

Netbeans - Entering items in a jComboBox

I have generated a GUI from netbeans in which I have placed a combobox too. By default, the items in combobox are item1, item2, item3, item4. But I want my own items. Netbeans doesn't allow editing generated code so how can i edit the comnbobox according to me. Note: I know one method by editing the "model" property of that jComboBox ...

Arranging Nodes in A JTree

Hello World, I have a JTree in which the user can drag/drop or re-arrange nodes, upon saving I have to re-arrange the nodes such that File type nodes must appear before Folder type nodes. I don't need to sort the files/folders name. User Tree: -FolderA +FFA1 -FA1 -FA2 -FolderB -FB1 -File1 -File2 +FolderC -File3 ...

Has my code followed the appropriate logic

The reason i ask this question is because i still get a null pointer exception even tho i am sure there is no issue but as usual there probably is some massive mistake i have made :D The lecture slides said this 1) Use variables to store the start-index and length of the sequence of array elements that must contain Mike's entry if the...

What is this type of method overriding called in Java?

I'm relatively new to Java and I'm using a new API. I came across this method override and I'm not sure what this is called: public void exampleMethod() { Button loginButton = new Button("login"){ public void onSubmit(){ //submit code here } }; } From what I understand, this is overriding the onSubmit m...

How to determine an incoming connection is from local machine

I have a SocketServer accepting incoming connections. For security reasons I should only allow local connections (connections from the machine on which server is running). How can I determine if an incoming connection is from another machine? Is the following code safe for this? Socket socket = someServerSocket.accept(); String remoteA...

Process execution tracing tools

I am currently in the process of investigating a very peculiar problem on our lab servers. Whenever we run a java program on a machine with a 64-bit SUSE SLES11 installation that has been accessed with Citrix, it just hangs. I have the latest updates on the machine but it doesn't help. If any of these circumstances change, it works: 32-b...

Java server cpu usage at 100% after two days continous running with about 110 users

I have a tomcat 6.0.20, apr 1.2, jdk 1.6.0_15 with mysql 5.1.38 running on a rhel box with 4 GB ram. There is one simple jsp/servlet application on it with 5 users, one struts 1.2.0.9 with 64 users on it and one struts 2.0 application with 35 users on it. The struts 2.0 users make an entry every second, about 900 entries in a day. I am ...

proxy classes of web-service using WSDL

Hello All, I am getting the following exception whenever trying to create proxy classes using WSDL. Few observations :- 1) My WSDL points out/imports following xsd http://200.123.23.196:9090/TOOLBOX/WSDL/temp/temparature.xsd. If i use the tempratue.xsd in wsdl from above URL, It always fails and throws following exception in eclipse. ...