j2ee

Should the jndi name for a datasource be looked up by a ServiceLocator?

I have a J2EE webapp which is used to upload a file which is then processed by a database procedure. Because we do not want the webapp to have to wait until the database procedure completes, it is executed in a different thread. The process running in the separate thread needs to obtain and close its own connection. The webapps usually...

Why make an EJB rather than a Web Service?

I would have thought that there is a lot of information out there on this, but I haven't found anything that really answers my question. What are the advantages of making an EJB rather than a web service? The only clear advantage I can come up with is performance. Even so, I can't find any hard data on how much more efficient EJBs are. ...

many-to-many (self referencing problem) vs double one-to-many

Hello! I'm facing some of the problem some of you already talked about and sorry to bring this out again. It's just like I still don't get certain aspect of hibernate. I'm using maven2, hibernate 3.2.5 ga, spring 2.6.5 SEC01, hsqldb 1.8.0.10, netbeans 6.7.1. I'm bulding a user and contat management and I've managed to get a working "m...

Call function periodically in Java

we need run one function periodically in Java web application . How to call function of some class periodically ? Is there any way that call function when some event occured like high load in server and so on . what is crontab ? Is that work periodically ? ...

Which java web framework to choose for client side and server side validation?

We are currently searching for a java framework , that made validation easily on server side and both client side,Spring,Hibernate,Play are the framework choices that we are searching,we are using annotation based development and this framework will determine our javascript choice too.Which is better framework (architecturally) at valida...

HQL with a collection in the WHERE clause

Hello good people! I've been trying for the this whole a query who is officially giving me nightmares. The system is a user and contact management. So I have UserAccount, Contact and Phone. UserAccount has a bidirectional one-to-many relationship with Contact and an unidirectional one on phone all mapped by a Set: //UserAccount ma...

Recommended way to develop using Jetty and Eclipse

Hi, I am currently developing a J2EE application and I would like to use Jetty. I would like to have iot integrated with Eclipse, so I could debug the appliaction. I've tried out couple of plugins (including WTP) but nothing works well enough. Run Jetty Run plugin is the best, but I cannot specify context-root in it, which makes it un...

Functional depedency analysis

Developers who have used eclipse cannot miss out the Cntrl+Shift+G combo - the easiest way to find all references to a particular member/method/class in your workspace. Consider a scenario where you are a new guy maintaining a web application written in java. Now, you are about to change a method signature, and you do a Cntl+Shift+G to ...

java configuration file

I have a method : private String getProperty(String property) throws IOException,ConfigException{ //first test if the config file exists. String propertyFile = "DataTransfer/Config/DataTransfer.properties"; if(!new File(propertyFile).exists()){ throw new ConfigException("the config file doesn't exist." + " Make sure the file...

Looking for a simple, secure session design with servlets and JSP

I'm working on an intranet-only web application (J2EE) that requires some basic security features. There will be relatively few authorized users for the site, but I still need to implement some sort of secure session. The basic flow I'm looking at is visit site => log in => use site => log out when done (or automatically log out when th...

struts2 action avoiding literal duplication

In my struts.xml file, I have: <action name="preregister"> <result>/WEB-INF/views/user/register.jsp</result> </action> <action name="register" class="com.dentlak.user.RegisterAction"> <result name="input">/WEB-INF/views/user/register.jsp</result> <result name="success">/WEB-INF/views/user/email-verification-needed.jsp</resu...

How do I access a text file from within my war

How do I know what file reference to use to get a file from my WAR. The structure of the WAR is: WAR src - model - web build   WebContent     META-INF     WEB-INF       LIB The JSPs are under WebContent, I have put the config.txt file under the WebContent folder and tried to get to it with Buffered...

Smartcard application using J2EE

Hai guys, I want to know how a smartcard application can be done using j2ee..... ...

Eclipse as an IDE - What do you find missing as a beginner in Java?

I am working on a solution that aims at solving problems that newbie programmers experience when they are "modifying code" while bug fixing / doing change requests, on code in production. Eclipse, as we all know is a great IDE. Features such as Code Completion, Open Declaration, Type Hierarchy, Package Explorer, Navigator, Finding Refere...

many-to-many JPA mapping inserting but not fething the child collections

Hello good people! i've hit a block once again with hibernate.I've posted numerous times on different aspects of the user and contact management that i've been building. The sad thing is that i didn't really have the time to play with it and understand it better before actually starting working with it. Sorry but English is not my ...

JBoss MQ tutorial

I'm looking for a JBoss MQ tutorial (on JBoss Tools) so that I can write an MDB and a client. I can find only JBoss Messaging. ...

Tool to find duplicate keys and value in properties file

is there a tool that tells me redundant keys and values that are there in my one or many properties file. ...

how can i retrieve the msg from HttpServletResponse.sendError

i have two tomcat servers that communicate between them. upon an error at one of the servers i would like to send an error response to the other server. i am sending the error using: resp.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); i am catching the response with org.apache.commons.httpclient.httpMethod. my questio...

creating a queue in JBoss MQ

I'm trying to call send a message to a JBoss MQ queue but it seems the queue is not bounded. I use the following code to send the message : Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");...

J2EE programmers do not write to files

Today one person told to me that "J2EE programmers do not write to files". Why can I not write to files from within a J2EE container (for example from JBoss)? What is wrong? ...