java

Class in one war not able to access classes in another war of same ear

I have an ear which consists of 2 war files one containing junit classes and the other one containing actual application classes which are referenced by the junits. Now when executing the junits i get a java.lang.NoClassDefFoundError Is it due to the junit class files are located in different ear and hence not able to access the applica...

Why won't it remove from the set?

This bug took me a while to find... Consider this method: public void foo(Set<Object> set) { Object obj=set.iterator().next(); set.remove(obj) } I invoke the method with a non-empty hash set, but no element will be removed! Why would that be? ...

problem in build.xml

When I gave ant myproject-war. I got the following error. can any one help plzz BUILD FAILED C:\Documents and Settings\personal\Desktop\project files\myproject\bu ild.xml:167: taskdef A class needed by class org.apache.jasper.JspC cannot be fo und: javax/servlet/ServletContext ...

name forgeign key in JPA?

I am using the Hibernate Tools ant task to generate DDL from JPA annotated entities. With hibernate annotations you can name the foreign key using @JoinColumn(name = "foo") @org.hibernate.annotations.ForeignKey(name = "fk_foo") Is there a pure JPA way of achiving the same? ...

CollectionAssert in jUnit?

Is there a jUnit parallel to NUnit's CollectionAssert? ...

How can I make MS SQL Server available for connections?

I'm trying to connect to MS SQL Server (running on my machine) from a Java program. I'm getting the following long winded exception: Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection pr...

How to create or write text file in servlet?

i have tried this code. I didn't create any file. I am doing this in netbeans where server is glassfish v2 public void create_file(String file_name) { FileWriter file_stream; BufferedWriter out_stream; try { file_stream= new FileWriter(file_name); this.out_stream = new BufferedWriter(file_stream)...

How can we convert XML file to CSV?

I am having an XML file <?xml version="1.0" encoding="ISO-8859-1"?> <Results> <Row> <COL1></COL1> <COL2>25.00</COL2> <COL3>2009-07-06 15:49:34.984</COL3> <COL4>00001720</COL4> </Row> <Row> <COL1>RJ</COL1> <COL2>26.00</COL2> <COL3>2009-07-06 16:04:16.156</COL3> <COL4>00001729</COL4> ...

selectBooleanCheckbox in a DataTable in ui:repeat

Hello, I'm having some problem using multiple selectBooleanCheckBox in multiple DataTables in ui:repeat. Something like this <ui:repeat var="f" value="#{mybean.values}"> <rich:dataTable value="#{f.values}" var="v"> <rich:column> <h:selectBooleanCheckbox value="#{mybean.selected[v.id]}"/> </rich:column> ...

If you don't clone in Java then what do you do and what do you call it?

Does anyone have any suggested or established best practices and naming conventions for copy constructors / factory methods etc in Java? In particular, say I have a class Thing and I want a method somewhere that returns a new Thing with the same value as a Thing passed in (or as the instance if it's an instance method). Would you have ...

Servlet mapping in apache tomcat 6.0.20

Im not sure that its possible to do what I want to accomplish. I want to map one single servlet to two different URL. I want both http://10.0.0.1/a and http://10.0.0.1/b to map to the same servlet. I know its possibe to do the following in web.xml; <servlet-mapping> <servlet-name>ServletName</servlet-name> <url-pattern>/b</...

JNI dependent libraries

Hi, I'm running a library via JNI (I didn't write it), and internally it calls another DLL. I get an error saying "Can't find dependent libraries" unless I put the path of the other DLL on the system PATH variable (I'm on Windows XP). I'd like to be able to handle this on the java command line, and I've already tried adding it to -Djava....

What is an IOR file, what does it do, and how does it work?

I believe it is related to CORBA in some way (I'm not sure). I'm curious as to its function and how it works. Google isn't helping me when I search for "IOR file", and I'm not sure what else I could search for. Thanks to anyone who can at least point me in the right direction with available resources. ...

java.sql.SQLException encountered when connecting to Oracle database

I get the following error when I try to run my project: java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169870080)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))) Any ideas? ...

Adding custom HTTP headers in java

Hello, I'm trying to create a simulation for our web Portal and need to add custom HTTP headers. I am to assume the user has already been authenticated and these headers are just for storing user information (ie, "test-header: role=user; oem=blahblah; id=123;"). I've setup a filter to extract the header information but I can't find a...

closing rmi registry

Using RMI to pass String object from WebAppA to WebAppB.WebAppB is the RMIServer whereas WebAppA is RMIClient.I have added ContextListener in WebAppB, so that the rmi service starts right away when the context is initialized in tomcat.And in the contextDestroyed method of tomcat I am trying to close/shut down rmi using the following stat...

What do those strange class names in a java heap dump mean?

I'm trying to track down a memory leak in a java process, using jmap and jhat. Every time I do this I see those weird notation for specific object types, like [S for string arrays and [C for Character arrays. I never remember what means what, and it's very hard to google this stuff. (EDIT: to prove my point, it turns out that [S is arra...

Java 2D Image resize ignoring bicubic/bilinear interpolation rendering hints (OS X + linux)

I'm trying to create thumbnails for uploaded images in a JRuby/Rails app using the Image Voodoo plugin - the problem is the resized thumbnails look like... ass. It seems that the code to generate the thumbnails is absolutely doing everything correctly to set the interpolation rendering hint to "bicubic", but it isn't honoring them on ou...

Using Mockito to test abstract classes

I'd like to test an abstract class. Sure, I can manually write a mock that inherits from the class. Can I do this using a mocking framework (I'm using Mockito) instead of hand-crafting my mock? How? ...

Rending reports with dynamic structure (Not template based approach)

Hello Friends, I need a reporting framework that would allow me to create reports with dynamic structure. Unlike Jasper Reports working mode in which you create a template for how your report will look like, I need exactly the opposite: I need a framework that will allow me to create reports with varying structure (Programmatic). The r...