java

read xml data

I need to parse xml data from string bufer or string ..i do code as follows. here on the line document doc =db.parse(eventXml ) ..it throws exception-- plesae find below code and exception .plese help me Code --- eventXml = strBuffer.toString(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf...

Java Large Files Disk IO Performance

I have two (2GB each) files on my harddisk and want to compare them with each other: Copying the original files with Windows explorer takes approx. 2-4 minutes (that is reading and writing - on the same physical and logical disk). Reading with java.io.FileInputStream twice and comparing the byte arrays on a byte per byte basis takes 20...

Does Berkeley DB java edition, support saving vectors

I am getting the following stack trace. Just want to know what your first impression is. Does it seem to be saying that Vectors cannot be saved to the Berkeley DB. What else can I provide you with, that will help work this out. Exception in thread "Timer-0" java.lang.IllegalArgumentException: Class could not be loaded or is not persiste...

How to write page headers when using iText library in java

I am developing a report generation application that could have tabular data across multiple pages. I am using pdfTable to create tabular data. I am issues with adding page headers. The problem is that when I add page header onEndPage event handler, I am not get the table to start after certain gap so that header is visible. ...

Can I create a 'window' object for javascript running in the Java6 Rhino Script Engine

I want to run some Javascript on my Java6 server - i.e. using the javax.script API, specifically the Rhino Script Engine. (Although another solution would be acceptable) The script file is created & supported by a third party, so I don't want to download it and edit it in case it changes over time. The script directly references the 'w...

Creating a shared HSQLDB database

In-process HSQLDB database are not expected to be opened by others, even for file-based storage. The documentation hints that this is possible: Server Modes, Advanced Topics, but I've not yet found a URL for how to activate this behaviour. Did anyone do this so they can share how to? ...

Java Threads

How do I implement a ThreadPoolExecutor? What needs to be done to use it? ...

TLS server accepts connection from client even client cetificate is not present in servers truststore ? why ?

TLS server accepts connection from client even client cetificate is not present in servers truststore ? why ? Server Code: tlsContext = SSLContext.getInstance(SSL_PROTOCOL); tlsContext.init(getMyKeyManagers(),null,null); SSLServerSocketFactory fact = tlsContext.getServerSocketFactory(); tlsServerSock = (SSLServerSocket)fact.createSe...

Java writeObject Vs. writeUTF

What is faster? out.writeObject(someString) or out.writeUTF(someString) ...

EJB Interceptors in Weblogic

I have an EJB in Weblogic 10.3 that has en EJB interceptor defined for it like such: @Stateless(name="MyEJB") @Interceptors ({AuditInterceptor.class}) public class MyEJBImpl extends BaseEJB implements MyEJB It appears as if the interceptor advice is only being applied to certain methods in the EJB. I am using the @AroundInvoke annota...

Evaluating XPath Commands with java

Hi I have an xml document like this <root> <cert id="1"> </cert> <cert id="2"> </cert> <cert id="3"> </cert> </root> now I get a request and want to select the cert with id 2 and want to return it in a function. What is the best way to do this? I thought about XPAth Expression, how can I use them in java? What would be ...

How can I use the java Eclipse Abtract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)

How can I use the java Eclipse Abtract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin) All the Eclipse AST examples that I've seen are for eclipse plugins. Is there a way (ie an example) of a project that uses the eclipse AST for a non-eclipse project. ...

What is the current status of GCJ at the moment (mid 2009)?

What is the current status of GCJ at the moment (mid 2009)? The latest news are from 2007, so I'm wondering if there is any form of progress? I remember that there was a while ago a compiled version of lucene available which used gcj to compile it from the java sources. Is there any other high profile project which uses gcj at the momen...

Why do I need a connection to create PreparedStatements ?

I would like to use prepared statements, for many reasons. But, I would like to create a method that looks like this: /* This opens a connection, executes the query, and closes the connection */ public static void executeNonQuery(String queryString); In other words, I want my application logic to only have to formulate the queries and...

How to wrap lines in a jtable cell?

Hello, I'm trying to implement a custom TableRenderer as described in this tutorial. I'd like to have the renderer line-wrap each text that is to long for the given cell. The idea is, to use a TextArea as renderer, as it supports line wrapping. However, the following code does not behave as expected: public class LineWrapCellRendere...

How can I store JEE configuration parameters outside of an EAR or WAR?

I want to store configuration for a web project outside of the web project (ear/war file). The application shouldn't know in which container it's running (WebSphere/JBoss etc.). What is the best way to handle this? Is JNDI a clean way? If JNDI can solve my problems, how should I configure it? (Custom Objects?) In my case are there o...

JDBC DAO - any good reference implementation?

Can anyone point me to a well written DAO using JDBC, that covers all the exceptions a DAO should handle. I looked at some samples at java.sun.com, their blue prints but there is a lot of theory and less code. Looking through Spring DAO source code will be enlightening but that's way too complicated for me. ...

Liferay portlet development with eclispe and pugins SDK

I am not sure, if this is a progamming question in the scope of this website. I am trying to create some simple portlet, which has some jsp Pages communicating with the java backend and vice versa. But any documentation states differen procedures, filenames and functions, than those used in the basic portlet, created by the Liferay plugi...

Is there a way to get apache-digester to intern strings for certain attributes?

I am a big fan of using apache-digester to load XML files into my object model. I am dealing with large files that contain many duplicates (event logs), and would therefore like to String.intern() the strings for specific attributes (the ones that frequently repeat). Since Apache-Digester reads the whole file before relinquishing contr...

displaytag external paging/sorting and getting true row number

I'm using external paging/sorting with a custom TableDecorator and the following DisplayTag table in a JSP: <display:table id="ixnlist" name="pageScope.itemList" sort="external" decorator="org.mdibl.ctd.pwa.displaytag.decorator.IxnTableWrapper"> <display:column title="Row" property="rowNum" /> ...more columns... </display:tabl...