java-ee

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...

Spring - How to call a method after bean initialization is complete?

Hi, I have a use case where I need to call a (non-static) method in the bean only-once at the ApplicationContext load up. Is it ok, if I use MethodInvokingFactoryBean for this? Or we have a some better solution? As a side note, I use ConfigContextLoaderListener to load the Application Context in web application. And want, that if bean ...

maven javaee application client plugin

I am pretty new to maven. Is there any plugin or packaging type suitable for building application client jar file ? I want to add the application-client.xml file to the META-INF folder inside the jar. The normal jar packaging doesn't include the file. ...

Best practice for EJB remote interface wrapping entitys

I currently have the excercise at university to create several Java-entitys (Person, Employee, Department, DepartmentType, ...) handled by JPA which should be accessed by the client through some EJBs (I think that's best practice?!). Now I think about how to organize/design the EJBs. Do you create one EJB per Entity? Or one EJB for all...

Recommended way to send email from a web app?

I have a web app on JBoss 4.2.3 and I'd like it to send email. I could do something like: try { Properties props = System.getProperties(); props.put("mail.transport.protocol", "smtp" ); props.put("mail.smtp.starttls.enable","false" ); props.put("mail.smtp.host","smtp.somehost.com"); props.put("mail.smtp.auth", "true" ); Authenticator au...

Application configuration files for Glassfish/Java EE 5 web services...

I am trying to write some simple Java web services so we can call Java code from .NET. So far, I got a proof-of-concept working under Glassfish. Pretty straightforward when the IDE does all the work. Now I'm really bogging down on stuff in Java that should be really simple. For example, I want to externalize my configuration so I can...

Best way for a 'forgot password' implementation?

I'm thinking what are the best method to implement the forgot password. I come out with 2 ideas. One, when user click on forgot password, the user is required to key in the username, email and maybe date of birth or last name. Then a mail with temporary password will be sent to user email account. The user use the temporary password to l...

Weblogic Bea 10.0 M1 and WorkManager

Hi there! I have to execute long running threads in a WebLogic Bea 10.0 M1 server environment. I tried to use WorkManagers for this. Using an own WorkManager allows me to specify my own thread timeout (MaxThreadStuckTime) instead of adjusting the timeout for the whole business application. My setup is as follows: weblogic-ejb-jar.xml:...

JEE Web - Switching from HTTPS to HTTP depending on resource

Using only standard JEE API (JAAS, Servlet API, JSF) How can I switch back from a CONFIDENTIAL channel to a Unsecured one? In my example I already managed to switch from an Unsecured channel to a Secured one for the resources in "*/secured/**", but I'm in need to switch back to an unsecured channel after a successful Authentication as t...

How to have Eclipse JEE automatically generate the exploded WAR for a web project?

I need to have a JEE project generate a WAR file automatically - preferrably exploded - as opposed to choosing Export -> War file. I have played with the various server defintions but have not been able to get either the JEE preview or the HTTP server to work, and before installing each of the external container specific servers I'd lik...

working with object with spring and hibernate

Hello people! hope everybody is cool.I've been trying to do something with spring-hibernate but it's still a failure.i'm very new to it.i need a little help.supposing a POJO class Users.i want to return an Users object by username.While i had no problem to return Users object by id by doing this return (Users) getHibernateTemplate()....

How to display a different JSP view for different types of objects

Assuming I have a list of Animal(s) with standard polymorphic behavior like Cat(s) and Dog(s). What is the best approach to display a different JSP view for each one in the list? <c:forEach var='animal' items='${animals}'> //show a different template per animal type </c:forEach> To be honest having a #toJSP for each bean is somethin...

Maven2: Best practice for Enterprise Project (EAR file)

Hello everyone, I am just switching from Ant to Maven and am trying to figure out the best practice to set up a EAR file based Enterprise project? Let's say I want to create a pretty standard project with a jar file for the EJBs, a WAR file for the Web tier and the encapsulating EAR file, with the corresponding deployment descriptors. ...

JDBC Connection to SQL Server 2000 reset randomly on Solaris server

Hey all, I have the following method being called in a Java EE web application. public static void submitToPending() { Db db; ResultSet rs; try { db = new Db("Database.properties"); rs = db.issueQuery(getDescriptorList()); while (rs.next()) { db.insertApplicationData(rs.get...

Checking patch integrity

Hello all, I am working on j2ee web application and we have the following requirement: it should be impossible to install application patch with arbitrary classes. Right now patches are done by manually adding jars with fixes or even individual classes to server classpath or to application EAR. We also cannot use signed jars since it is ...

JBoss / Eclipse RCP Integration

I've run into a problem with RCP and JBoss. I'm attempting to seperate the JBoss client libraries (i.e. the .jar files in the 'client' directory of the jboss distribution) from the ejbmodule. The dependency hierarchy goes: company.client (ejbmodule containing ServiceRemote bean) org.jboss.client (jboss client libraries) The probl...

eclipse is not building my EAR correctly - sometimes it forgets the war, and always leaves out my library jars - why?

I just upgraded to eclipse galileo from ganymede sr2 and now eclipse is doing a really bad job of building my EAR file during deployment. There are several utility jars that are supposed to be included that it is completely ignoring, and there is a single war file that it only includes in the EAR occasionally. Thus, when I deploy to gl...

JBoss: How to generate a Web Service FROM a WSDL?

I need to prototype a very simple system which sends a request to a remote web service, which will then callback on my own web service once it's finished processing. Unfortunately, I have to implement their WSDL for the callback. Is there a nice simple way of generating a JBoss application which will correctly implement the WSDL, and ru...

How to use login callback for application client.

I'm writing a Swing application client (it's runs over webstart, and I'm using glassfish). In the application class I have: @EJB private static MyBean myBean; and in MyBean I have: @Remote public interface MyBean { public int getRand(); } @DeclareRoles(("admin")) @Stateful(name="MyBean") public class MyBeanImpl implements MyBean {...

Remove Session scoped managed bean on browser close

Hey all, In a JSF application, I want to remove a session-scoped managed bean when the user closes their browser window. I've used a link before that executes the following: session.removeAttribute("<nameOfManagedBean>"); This seems to do the trick nicely. However, I'd like this same code to run even if a user clicks on the "X" on th...