java

Can't set LevelRangeFilter for log4j

I am using this property file to setup log4j in Spring: log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender log4j.appender.EMAIL.filter=org.apache.log4j.varia.LevelRangeFilter log4j.appender.EMAIL.filter.levelMin=FATAL but getting: log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter". Any...

Compiling java code with non java extension file in eclipse

Hi, I am working on a project in which there are jsp files and some files with extension .jsps. And these files only include java snippets in form of <% %> and javascript code. And this .jsps file is included in jsp file. For compiling, eclipse is just ignoring .jsps files. And I want to compile all the files using eclipse version 3.4.1....

How to put 'null' into column using HQL ?

How to build valid HQL string, which is equivalent to UPDATE table SET field = null WHERE .... ...

Problem reading an Integer in java that was written using python’s struct.pack method

First I write the integer using python: out.write( struct.pack(">i", int(i)) ); I then read the integer using DataInputStream.readInt() in Java. I works but when it tries to read the number 10, and probably some other numbers too, it starts to read garbage. Reading the numbers: 0, 4, 5, 0, 5, 13, 10, 1, 5, 6 Java reads: 0, 4, 5, 0, 5, 1...

HA Tomcat file writing solution needed

We have a simple Webapp running on two Tomcat instances behind Apache (a Tomcat HA setup using mod_proxy_balancer and mod_proxy_ajp). The role of the webapp is to write incoming request data to a log file. Given that each tomcat instance is running in it's own JVM, how should we implement the log file writing? It would be excellent if ...

Using different projection functions in Hibernate criteria API based in Dialect

I want to use a standard deviation projection in a query that Im constructing using the criteria API. I can do something simply like this public class StdDevProjection extends AggregateProjection { public StdDevProjection(String propertyName) { super("stddev", propertyName); } public Type[] getTypes(Criteria criter...

Best way to serialize a Float in java to be read by C++ app?

Hi, I need to serialize a java Float to be read by an application written in C++ over Socket comms. Is there a standard for this? It would be easiest to use the method floatToIntBits in the Float Class, however I am not sure how standard that is. ...

what do you think is the best IDE in struts2

share your idea~ ...

A regex for a class definition in java

The problem is as follows: There is a massive codebase in Java (hundreds of files in tens of packages) where we need the ability to add and remove the keyword strictfp in each class definition. I am planning to use either sed or awk to perform this substitution. However, I would like to avoid the word "class" in comments or elsewhere fr...

Does Terracotta make JMS an unneeded layer?

We're currently writing an application for which IT has already purchased hardware for. Their approach was to buy big hardware on which we would deploy. In order to add more processing, they plan on adding additional servers with identical software. In order to accomodate this design, we are using Terracotta to provide the ability to run...

Verifying a signature in java using a certificates public key

I'm looking to convert some C# code to the equivalent in Java. The C# code takes some string content, and a signature (generated using the private key, on a seperate machine) and combined with the public key it verifies the signature matches, providing a level of assurance that the request has not been tampered with. public bool Veri...

About character code conversion in Post by the JAVA

Japanese Yen Mark is expressed with two ways of next 0x5c (ASCII) 0xa5 (utf-8) When I did a POST of 0xA5 in Java6, environment of Struts2, at the stage that I output in log, I become 0x5C. Where will substitution of a character code be performed to be concrete? ...

Why does a new SimpleDateFormat object contain calendar with the wrong year?

I came upon a strange behavior that has left me curious and without a satisfactory explanation as yet. For simplicity, I've reduced the symptoms I've noticed to the following code: import java.text.SimpleDateFormat; import java.util.GregorianCalendar; public class CalendarTest { public static void main(String[] args) { Sys...

Rewriting method calls within compiled Java classes

I want to replace calls to a given class with calls to anther class within a method body whilst parsing compiled class files... or put another way, is there a method of detecting usages of a given class in a method and replacing just that part of the method using something like javaassist. for example.. if I had the compiled version of...

How to send and recieve an ajax request with jQuery?

I am new to jquery and am having trouble following the documentation. I have a variable in javascript (that I already obtained from an html form) that I would like to send using AJAX to the server. I want to the server to do whatever it needs to do with that value and then reply with either "success" or "failure" (I know how to do the b...

Can I call class files that are within a jar library located in another jar file?

I am trying to access the class files packaged as a library but unfortunately the jar libraries should be packaged in another jar file. As an example say I have a.jar that contains some class libraries. I can call (import) the classes in the jar file from my external java application. Now I need to put this a.jar inside another jar say...

Best practices creating Java service or daemon scripts

I'm looking for a tool to run java server processes as daemon services in Linux (and potentially on Windows and other OS's). I'm looking for the best practices when it comes to how to build production capable scripts and launch configuration. I'm familiar with best practices when it comes to a project's build, using Apache Maven, or som...

Where to start for my java program (Using the folder names to get info from IMDB)

I finished first year comp sci. And i want to spend some time working on the things they have taught us in the first year (lot of java and a bit of C)... Anyways as a project, i wanted to do something i need, and what i need is a program to run through my movie folder and get the ratings and some basic info from IMDB... I'm not sure w...

Is it possible to extend a generic class parameter in Java?

Does something like this make any sense at all in Java? class A<T extends B> extends T{ int fun1() { .... } } abstract class B extends X implements C { } interface C { int fun1(); } I want class B to extend both X and C ideally. But since there is no multiple inheritance in Java, I'm trying to come up with a slicke...

How to use SLF4J Loggers in a JSP

I'm in the process of migrating the logging of a middle-sized application from a custom solution to something more standard. I've decided on using Logback and SLF4J, and I have successfully migrated most of the Java code. However, I have quite a bit of JSPs that simply use System.out for logging. I've never worked much with JSPs, and sta...