java

XML Digital Signature validation

I was trying to validate an XML signature. The validation according to this tutorial works fine. But I also tried to a second approach. To verify it with the verify method of the Signature class I extracted the signature and the certificate from the xml file, and I did the following: public static boolean checkSignedFile(byte[] ...

Java: Howto know where the jar is located in Linux

Hello, In Linux, the JVM sets the working direcory equal to the homefolder from the user. In Windows is this the folder where the jar is located. How can I find where the jar (from my app) is located to change the working dir? Martijn ...

What are the advantages of using named queries under Hiberante Annotation

Are there any advantages of using named queries vs what we have? Looking at performance, usability, maintainability etc etc.... In our application we have defined our queries as such: private static final String SELECT_CODE_FOR_STORE = "select DISTINCT code from Code code " + "join code.codeDescriptions codeDesc " + "j...

Facelets and JSP in same project?

Is it possible to use Facelets pages and .jsp style ICEfaces pages in the same project? In looking at the ICEFaces Facelets tutorial, the migration appears to be an all-or-nothing switch. Is it possible to support both (for a slow migration)? ...

How to handle two jar files in java?

I am using Netbeans IDE for a java project. In this project i need a jar file "htmlunit-2.6.jar". I have included this jar file in the project libraries folder. I have instantiated one of its class "WebClient" but this class needs other classes of "commons-httpclient-3.1.jar" file. Now I have also included "commons-httpclient-3.1.jar" ...

CallableStatement setString - Unsupported character(s)?

I have a Java application decoding a UTF-8 encoded String received over the wire and saving it to a varchar column in my database (SQL Server 2000). I am saving the record using JDBC's CallableStatement (calling the setString method to set the parameter for this column). The problem I'm seeing is that a particular String has been writt...

tagging methods and calling them from a client object by tag

Hello, I have been trying to figure out a way to tag several methods from my base class, so that a client class can call them by tag. The example code is: public class Base { public void method1(){ ..change state of base class } public void method2(){ ..change state of base class } public void m...

Using Hibernate sequence generators manually

Basically, I want a way to access sequence values in a database-neutral way. The use case is that I have a field on an entity that I want to set based on an incrementing value (other than the id). For instance, say I have a Shipment entity. At some point after the shipment gets created, it gets shipped. Once it gets shipped, a manife...

How can I give a component more than one DropTargetListener?

I just learned (the hard way) that Java Components can only have one DropTarget. No sweat, I said, I'll just add another DropTargetListener to that DropTarget--only to discover that DropTargets can only have one DropTargetListener! I have two DropTargetListeners that listen for very different events (one handles things being dragged an...

Handling special characters in XML when transforming with Saxon

I'm attempting to apply a stylesheet to an XML document using Saxon. Given an XML file that was generated in Microsoft Word and that has Microsoft Word-style quotes, such as around FOO in the following document <?xml version="1.0" encoding="UTF-8"?> <doc> <act> <performer typeCode=“FOO“ /> <performer typeCode="BAR" /> ...

Fresh OpenEMM installation shows bean errors on some pages

We have deployed a fresh openemm installation on a resin server (which wasn't exactly straight forward due to an enormous amount of dependencies although resin is the recommended and default application server). This is our setup: latest Gentoo GNU/Linux OpenEMM 5.1.1 (compiled from source, including a huge amount of dependent jars) Re...

Setting up multiple instances of JBoss on the same machine

I've found next page in JBoss Community - http://www.jboss.org/community/wiki/ConfigurePorts There is next text: Edit server/default/conf/bootstrap/bindings.xml But I do not see file bindings.xml in JBoss 5.1.0 GA. Does anyone know - what files should be changed in order to hav ability to start several instances of JBoss 5.1 on the...

.NET TripleDESCryptoServiceProvider equivalent in Java

Hello nice people, Please, just don't ask me why. I just have this code in .NET that encrypt/decrypt strings of data. I need now to make 'exactly' the same funcionality in java. I have tried several examples for DESede crypt, but none of them gives the same results as this class in .net. I even though on making a .net webserbvice behi...

Can't create foreign key

I'm trying to add a foreign key to an existing table, and was having issues. I figured that I had an error in my syntax, so I updated my hibernate.cfg.xml file to auto-update. As it turns out, hibernate had the same error. Here's my SQL to add the foreign key: alter table pbi add index FKEA3F7BDE9BAB051 (FK_idP), add constraint FKEA3...

Proper EJB Exception handling - ClassNotFoundException from client

I have some EJBs that use Hibernate to persist data to the database. I have a thick Swing client that talks to these EJBs. The client knows nothing about the database (no driver jar). During one transaction a Hibernate ConstraintViolationException can be thrown. I catch all exceptions and wrap them in an EJBException like so: catch(Hi...

"NoClassDefFound exception: Could not initialize class" error help!

When I run my project, I get numerous outputs of this error: Sep 9, 2009 8:22:23 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet Jersey threw exception java.lang.NoClassDefFoundError: Could not initialize class SpringFactory at com.point2.prospect.persistence.hibernate.HibernateTran...

How to unit test a Spring MVC controller using @PathVariable?

I have a simple annotated controller similar to this one: @Controller public class MyController { @RequestMapping("/{id}.html") public String doSomething(@PathVariable String id, Model model) { // do something return "view"; } } and I want to test it with an unit test like this: public class MyControllerTest { @Test ...

profile java code

I need to profile my JAVA SRC code for some particular problem I am currently working on. I've been using the trial version of a tool called JProfiler. I'd like to learn of some good community open-source tools, if available; other than that I am also looking forward to learn of some standard techniques that are widely adopted (or must ...

how to login to a website through java?

I have tried several ways to login to a website through java. I have used watij, HTMLunit etc. but due to not so familiar with any of these, I am not able to login successfully. Can anyone tell me in detail how to login through java To be more specific, I want to login to the ORKUT and want the pagesource of the page that comes after l...

Save using JFileChooser with pre-populated file name?

Hi, I am trying to make saving and loading easier for some GUIs that I've made, and I would like to be able to pre-populate a filename for the user on save. Getting the JFileChooser to point at a convenient directory is easy enough, but pre-populating the name doesn't seem so easy. Currently, my code is: JFileChooser f = new JFileChoo...