java

Seam/Hibernate validator listener

Hi, We use a standard SEAM setup here ... complete with the validation system that uses hibernate. Basically what happens is a user enters a value into an html input and seam validates the value they entered using the hibernate validation. Works fine for the most part except here's my problem: We need to record the results of validati...

Random Session Invalidation

I am running a J2EE web application in Tomcat, and recently I have been tasked with adding metrics to the application. I am using a SessionListener to detect when the session is destroyed, and then uploading the metrics to a database. My Session timeout is set in my web.xml to 30 minutes, and I am not invalidating the session anywhere ...

classloader.getSystemResourceAsStream returns null

Hi everyone, I'm trying to load a properties file without using the actual path of the file. I've already done that on some other simple apps using: InputStream inputStream = ClassLoader.getSystemResourceAsStream(PROPERTIES_FILE); props.load(inputStream); But this time it doesn't work. The inputStream is null for some reason. PROPERT...

Google AppEngine/Java and existing DB

Is there a way to upload database contents to Google App Engine for Java, like the bulkuploader script in the Python version? If not, how would you get existing data into your GAE/J app? ...

there is something called Self running applications?

I need to create an application "dll, script or exe" which when the user upload on a folder on his server using his ftp, it will automatically run on the current folder and do some image manipulations in the folder images, My Question is how to make something like this, which the user will not need to configure anything on his server, a...

What is a good way to handle a version number in a Java application?

I am developing a desktop app using Java and Swing Application Framework. I have an application about box and I'd like to have that box contain some indication of what version is being tested. My preference is for that value to be changed in an automated fashion. I'm using CruiseControl to build the application triggered off the commi...

Hibernate/JPA inheritance issue on weblogic

Im getting a weird error when running my spring2.5.6,jpa(hibernate3.4) webapp in weblogic 10.3 [ERROR] Javassist Enhancement failed: com.xxx.domain.model.Scheme java.lang.NoSuchMethodError: pcGetManagedFieldCount at com.xxx.domain.model.Fund.<clinit>(Fund.java) at sun.misc.Unsafe.ensureClassInitialized(Native Method) ...

How to comment out calls to a specific API in Java source code

I want to comment out all calls to an API (java.util.Logging, in my case) in my codebase. Is there a good library to accomplish this easily? I tried Eclipse ASTParser, but that is tied to Eclipse. I am now struggling with PMD's parser. I haven't yet looked at it, but can Jackpot do this? Any other suggestions? ...

Changing System.in in eclipse to read from a file

This seems like kind of a silly question but is there a way to change the standard in in eclipse. If I was doing this from the windows console it would look like "java myprogram < stdin.txt" ...

EHCache + Hibernate Error: Cached Item Was Locked

I have been trying to figure out this problem for a month or so now, and it has been driving me crazy. Basically I want to keep this from happening: FINEST: Cached item was locked: com.cache.dataobject.Part.parts#0 FINE: select parts0_.mainPart_id as mainPart3_1_, parts0_.id as id1_, parts0_.id as id182_0_, parts0_.mainPart_id as mai...

Disable Java reflection for the current thread

I need to call some semi-trustworthy Java code and want to disable the ability to use reflection for the duration of that code's execution. try{ // disable reflection somehow someObject.method(); } finally{ // enable reflection again } Can this be done with a SecurityManager, and if so, how? Clarification/Context: This is ...

Groovy + JPA + Spring not working

I have the following java class: package domain; //imports @Entity public class User { @Id @GeneratedValue private long id; private String name; private String password; private String mail; //Getters, Setters and Constructors } When I change the file extension to .groovy, the application stops working. In ...

Relative path to SQLite DB in context.xml

Is it possible to use a relative path to an SQLite database file in the context.xml file of a Java web application? At present, I have: <?xml version="1.0" encoding="UTF-8"?> <Context path="/mywebapp"> <Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" ...

Limiting Profiling in Visual VM

I am trying out the VisualVM program that comes with the new JDKs. I am doing profiling on it and trying to profile CPU on only methods in a particular package. I put the following in the "Profile Only Classes:" jig.* Where jig is the package I want to instrument. Unfortunately I get back results on other methods that are not in tha...

Using Spring + Hibernate Transactional cache in Tomcat?

It seems that Hibernate transactional cache mode requires the use of a JTA transaction manager. In an app server such as Glassfish, Weblogic, etc, Spring can use the JTA transaction manager. Tomcat does not have a JTA transaction manager. Is there one that people use in this scenario? Or do people just not use transactional cache mod...

How do I create a new HttpSession in a RESTful webapp ?

I have a need to create a HttpSession (via cookie) whenever a client invokes a particular UI. Assumptions: Let's assuming that I'm not going to worry about any deep oAuth-like authentication dance. JESSIONSID cookie impersonation is not an issue for now. The server is tomcat, thus a JSESSIONID cookie is sent down to the client if a n...

Is there a way to call the STL Libraries of C++ from Java using JNI?

Is there a way to call STL libraries from JNI, I believe JNI provides a C like interface for native calls, how do we achieve this for the C++ template libraries? ...

A Java equivalent of C's fflush? [problems reading values]

On my computer programming class in college, we were asked to create a Java program to read and store various elements on a list. Storing is not a problem, but I'm having some issues regarding the reading of the values. I'm using "variable = input.nextLine();" (if the variable is String), and the problem is that when I read several valu...

UTF-8 to EBCDIC in Java

Hello, Our requirement is to send EBCDIC text to mainframe. We have some chinese characters thus UTF8 format. So, is there a way to convert the UTF-8 characters to EBCDIC? Thanks, Raj Mohan ...

How do I call dll inside Java?

How do I call a DLL inside Java program ? ...