java

XML Validation

Hi, I want to validate an XML file against RELAXNG schema provided. Searching on the net gave me hints to create a Schema instance using SchemaFactory by providing the appropriate Schema Language. So as per my requirement I used: *SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);* But the following exception was thrown at run: ...

Spring user transaction with hibernate

I want to control hibernate transaction myself so I can rollback at any time. I calling a thread to do business but not waiting for it to finish its job and update DB. This update is only available when the method ends but I want to commit changes in each for loop so I need to control hibernate transaction. My Sample code is below: for...

Why is WSDL parser still importing external documents?

I tried to turn off importing documents in WSDL4J (1.6.2) in the way suggested by the API documentation: wsdlReader.setFeature("javax.wsdl.importDocuments", false); In fact, it stops importing XML schema files declared with wsdl:import tag, but does stop importing files declared with xs:import tags. The following code snippet [see ...

store into mysql Meduimtext and largtext

hi every one, when I want store variable in Mysql using JDBC what type shoud I get for mediumtext and larg text? can i get String or must get Byte[]? ...

Marshalling polymorphic objects in JAX-WS

I'm creating a JAX-WS type webservice, with operations that return an object WebServiceReply. The class WebServiceReply itself contains a field of type Object. The individual operations would populate that field with a few different data-types, depending on the operation. Publishing the WSDL (I'm using Netbeans 6.7), and getting a ASP.N...

Sharing ivy configurations

I'm maintaining multiple projects backed by ivy configurations. Many configurations overlap, such as: common build configurations ( pmd, findbugs ); dependency groups ( spring ); Is there a way to import these dependencies by referencing a shared configuration? N.B. Please don't suggest Maven, as I know about it, but it is not (ye...

How would you find out if a machine’s stack grows up or down in memory? (JAVA)

Hi Everybody I have a C program to check whether the machine stack is growing up or down in memory in. It goes like that : #include <stdio .h> void sub(int *a) { int b; if (&b > a) { printf("Stack grows up."); } else { printf("Stack grows down."); } } main () { int a; sub(&a); } Now i want to do the same in Java. :-) An...

Maven: How to include jars, which are not available in reps into a J2EE project?

Hello, in my J2EE project I've a couple of dependencies, which are not available in any Maven repository, because they're proprietary libraries. These libraries need to be available at runtime, so that have to be copied to target/.../WEB-INF/lib ... Right now, I'm listing them as system dependency in my POM, but with this method the pr...

Setting value in JList

Yes, setting value to a JList, know that. But i want to know is there an easy way to implement custom JList on which setSelectedValue() will not raise event to to inform attached listeners. I want to keep it quiet :). ...

classloading in JBOSS

Hi If we have a A.jar that contains B.class and this file is located in JBOSS/server/default/lib and WEB-INF/lib of an EAR file. We have java2ParentDelegation is turned off. if we want to load the B.class which one will be loaded? what if java2ParentDelegation is turned on? ...

Console output retained in char[] causes OutOfMemoryError

I've got an applet that keeps running out of memory. A heap dump analysis shows that the culprit is a char[] owned by the traceMsgQueueThread that contains the entire contents of the java console output. This grows over time as log messages are sent to the console until eventually the applet runs out of memory. This only seems to occu...

Get Current Time of CalendarEntry of Google Calendar API

I was wondering, is there anyway to get the current time of a CalendarEntry, of Google Calendar API. I try to use the following hack : try { if (calendarEntry.getSummary().getPlainText().equalsIgnoreCase("XXX")) { calendarEntry.setSummary(new PlainTextConstruct("YYY")); } ...

How do I call some blocking method with a timeout in Java?

Is there a standard nice way to call a blocking method with a timeout in Java? I want to be able to do: // call something.blockingMethod(); // if it hasn't come back within 2 seconds, forget it if that makes sense. Thanks. ...

Page Expiration in Java(Wicket)

I'm writing a wicket project for a social network.In my project i have authentication so when a user enter address of the home page he is redirected to login page in this way: public class MyApplication extends WebApplication { private Folder uploadFolder = null; @Override public Class getHomePage() { return UserHo...

Design decision: class implementing multiple patterns or other method?

I want to create a "singleton-factory class" to retrieve my specialized objects. It is possible to create such a class and does it give me some performance surplus over a simpler solution like a static factory? Or are there any other solutions? This class would be a key component of a data intensive application dealing with constant dat...

How to connect a webserver

how to connect and retrive data from one webserver through coding in android application? How to achieve this ? Give me sample code for this ...

Organising Imports in NetBeans

Netbeans is able to organise imports in a similar fashion to eclipse, but: it seems unable to remove unused imports for classes that can't be resolved (and are no longer used) I can only organise one class at a time - eclipse allows import organisation on packages and projects etc. Is there some way that I can fix these problems? ...

Request methods on https-server

Hey everyone, I don't know whether my title is correctly articulated, but I have following problem: I have a self-written Java webserver, that handles incoming client requests. It works fine with all the request methods (GET, POST, HEAD, OPTIONS, DELETE, ...). It also works fine with sending files and stuff when I use http. GET and POST...

problem with select Double in Hibernate

Hi every one, I have problem when want read object with where (double variable) this is my Code : BranchBuilding Table: @Entity @Table(name = "branchbuilding", uniqueConstraints={@UniqueConstraint(columnNames={"buildingname","branch_fk"})})//uniqueConstraints={@UniqueConstraint(columnNames={"username","buildingname"})} public class Bra...

Patterns/Principles for thread-safe queues and "master/worker" program in Java

I have a problem which I believe is the classic master/worker pattern, and I'm seeking advice on implementation. Here's what I currently am thinking about the problem: There's a global "queue" of some sort, and it is a central place where "the work to be done" is kept. Presumably this queue will be managed by a kind of "master" object. ...