j2ee

writing test case for a DAO on a J2ee Application

I am trying to write some test cases for my DAO classes in a J2EE applications. Methods in my DAO classes try to get connection to the Database based on a JDBC URL (which is on the app server). So from the front end if I click bunch of stuff and make the DAO trigger it runs fine. However, when I write tests cases for the DAO and the D...

Deployment failed while installing a new war file in IBM WebSphere Application Server Community edition

I am getting the below error while installing the war file mentioned here. http://www.ibm.com/developerworks/websphere/library/techarticles/0809%5Fvamsi/0809%5Fvamsi.html Deployment Failed Unable to create configuration for deployment org.apache.geronimo.common.DeploymentException: Unable to create configuration for deployment at org....

Publishing a java web application using Netbeans

Can you publish a Java web application to an instance of a running remote Tomcat/Glassfish or be it any J2EE app server from netbeans, similar to the way you publish a web application using VS? If yes, please provide the steps ...

Hibernate One-to-one Mapping with interface.i need advice

hello good people i'm developping an application where all the pojos are exposed as interface but we map the real implementation class.we are using spring and JPA annotation.i'm about to test the one-to-one relationship and i'm having a light problem with the interface. Caused by: org.springframework.beans.factory.BeanCreationExcepti...

hibernate interceptors : afterTransactionCompletion

I wrote a Hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[] arg3, Type[] arg4) throws CallbackException { for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(onSave) : "+entity.toS...

JNDI Names -- Is Prefix "jdbc/" needed?

What's up with JNDI names? I'm trying to get a javax.sql.DataSource using the new annotations feature of Java 5. It's not working for me, so I want to ask... I have a in my web.xml, inside of it is an element. I'm switching between "jdbc/MyDB" and "MyDB". Neither makes my class-based DataSource work (it's always null) but in another e...

Is this Spring training useful?

We have a Spring + Ibatis based J2EE app. I planned to wrap around our DAO's (which call iBatis templates ...by getting spring beans) with test cases. I don't have much experience with JUnit so I thought that simply making an object of my DAO and then calling one of the methods will work. But wrong I was, turns out that the whole J2EE ...

How to do dynamic URL Rewriting in J2EE

Back in my ASP.NET days, I used URLRewriter.NET to do dynamic URL Rewrites. Basically, it's an HTTPModule that intercepts page requests and rewrites the URLs according to rules that you define, very similar to MOD_REWRITE. However, it also lets you define a "Custom Transform," a class with a single method that does URL translations for...

afterTransactionCompletion not working

I created an hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[] arg3, Type[] arg4) throws CallbackException { for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(onSave) : "+entity....

How do I display the current state of a Java application on demand via a webpage

Hello I have a very simple Java application which downloads a set of foreign exchanges rates from Yahoo! finance and performs some calculations on them. I am currently running this application in Eclipse. I would now like to do two things: 1. Deploy the application on a VPS so that it can run 24 x 7 2. Develop a management console, so th...

Working with hibernate multiple Criteria with logical AND

hello good people So far i've been working with only a case with 2 properties with and as logical operator so i use LogicalExpression like so Criterion eqRef = Restrictions.eq("referenceID", referenceId); Criterion eqType = Restrictions.eq("verificationType", type); LogicalExpression and = Restrictions.and(eqRef, eqType); this time al...

Java/J2EE standard practices and design choices

I have a couple of design/architectural questions that always come up in our shop. I said "our", as opposed to "me" personally. Some of the decisions were made and made when J2EE was first introduced so there are some bad design choices and some good. In a web environment, how do you work with filters. When should you use J2EE filte...

creating a JAR file programmatically

I created a Jar file from my java code : public void create() throws IOException{ FileOutputStream stream = new FileOutputStream(this.packagePath); JarOutputStream out = new JarOutputStream(stream, new Manifest()); out.close(); //jarFile = new JarFile(new File(this.packagePath)); } I get a META-INF directory, with a MANIFEST....

How to implement logout in Struts application

Hi, I have J2EE app on which the logout is not implemented properly, my intention is to close all DB resources once the user logs out. Not sure if session.invalidate(); will really help, I will try it today. Please advice what would be the best to way to implement logout so that all valuable resources are released once user logs out. ...

JBoss automatically undeploys EJBs

we have a situation at office. JBoss automatically unloads all deployed EJB's without us knowing why. here's the log we got : 2009-11-09 15:59:51,375 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 14s:704ms 2009-11-09 15:59:51,390 DEBUG [com.ar...

Where should I put this configuration setting?

I'm designing a fairly small web application which will run on a Sun application server (v9.1). It only has a few pages, no database of its own, and will retrieve/update data via web services. There's one block of text on one of the pages which we anticipate will need to be updated occasionally (a few times a year?) by a system admin. Wh...

Where can I find good unit testing resources for EJB and J2EE?

Which online resources, tutorials or books can you recommended to get started with unit testing J2EE / EJB3 applications? So far I have found ejb3unit, Jakarta Cactus and the Maven Cargo plugin. It would be helpful if there are complete working examples, ready to run. Target containers are the open source products GlassFish, JBoss and ...

Sample J2EE projects using J2EE design patterns

For .Net there are lots of projects that Microsoft/others provide via which one can learn how patterns etc. are implemented in real life projects. I am looking for ones for J2EE (apart from the samples that Sun provides on:http://java.sun.com/javaee/reference/code/). Am looking for more complex ones. May be using JSF/Spring/Struts ...

Determine Which Application Server our application is deployed to?

Our J2EE Application is deployed to JBoss and sometimes to OC4J . Can I know which one is being used? I hope there is a method returning the container information on runtime. ...

Combination of field as unique where one is a one-to-may unidirectional with HIbernate/JPA annotations

hello i'm not sure whether the title depicts the my situation very well.I'm developing a user and contact managment system with hibernate. i have an UserAccount pojo, contact pojo and phone object.i limited it to 3 since since those are in concern.UserAccount has a bidirectional with contact, and both have unidirectional with phone pojo....