spring

Profiling a Java Spring application

Hi guys, I have a Spring application that I believe has some bottlenecks, so I'd like to run it with a profiler to measure what functions take how much time. Any recommendations to how I should do that? I'm running STS, the project is a maven project, and I'm running Spring 3.0.1 Cheers Nik ...

Updating to Spring 2.5.5 causes a javax.servlet.UnavailableException: org.springframework.web.struts.DelegatingTilesRequestProcessor

I have been told to update some application from Spring 2.0.8 to Spring 2.5.5. This application is using Struts 1.2.7. Once I change the Spring.jar I get the following exception while loading in JBoss 4.0.5: 10:14:57,579 ERROR [[/PortalRRHH]] Servlet /PortalRRHH threw load() exception javax.servlet.UnavailableException: org.springframew...

What is the most simple way to execute java class every 30 seconds

I've been reading about java/spring/hibernate and worked trough a "dummy" examples so I told my friend to recommend something a bit harder for me, and now I'm stuck.. here is the simplest class I could think of package spring.com.practice; public class Pitcher { private String shout; public String getShout() { return ...

Spring: How to assure that a class is only instantiated by spring and not by keyword new.

Hi, Is it possible to assure that only spring can instantiate a class, and not by the keyword new at compile time? (To avoid instantiating by accident) Thank you! ...

JMS template credentials default value

Hello everyone I'm trying to work with jboss messaging, does anyone knows the default value for these java.naming.security.principal and java.naming.security.credentials or how can I set them? <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="jav...

Creating a form that doesn't map to an entity

Using spring MVC, how would I create a form that doesn't map to a entity (i.e. it has properties from multiple entities). I want to also validate and use their 'results' object that has the errors collection etc. Any online examples of this? I need to see it to understand it (newbie) ...

Spring: Inject static member (System.in) via constructor

I wrote some sort of console client for a simple application. To be more flexible, I thought it would be nice to only depend on java.io.Input-/OutputStream, instead of accessing System.in/out directly. I renamed the class ConsoleClient to StreamClient, added setters and made sure that the instance fields are used instead of System.in/ou...

Spring Security 3- How to customize username/password parameters?

How do you customize the UsernamePasswordAuthenticationFilter usernameParameter (j_username) and passwordParameter (j_password) properties when using the <http ... /> Spring Security 3 namespace? It's my understanding the <http ... /> creates the filter, but I don't see how to customize it. ...

Logging exceptions during bean injection

I think this is a pretty basic question, but after Googling around I can't seem to find the answer. What I need is a way to log some custom output with log4j during Spring bean construction. I have a factory class called ResponderFactory (being used as an instance factory in Spring) with a factory method that can throw 2 different types...

Access and modify attributes/objects which are not part of the form backing bean

I use Spring MVC (via Spring Roo) to build a small web application for administering persons. In the page for creating a person the bean Person is used as form backing object (key "person" in the model map). <form:form action="${form_url}" method="POST" modelAttribute="person"> I would like to add some attributes to the model map whic...

Conversion of bytes into a type without changing the application (ie storing the conversion method in DB) with Spring 3.0

Is there a way to store a conversion strategy (for converting some bytes) into a database and then execute it on the run time. If one were to store a complete java file, you would need to compile it, store the class and some how inject into the already running system. I am not sure how this would be possible. But using some kind of dyn...

zk selecting combobox item programatically

Hi, I cannot set the value of combobox programatically can some one tell me what missing in the code public class Profile extends Window implements AfterCompose { @Override public void afterCompose() { Session session = Sessions.getCurrent(false); ApplicationContext ctx = WebApplicationContextUtils.getR...

How to solve "NullPointerException" with "Server.processing" error while we are using Flex Builder 3 and BlazeDS?

I am using Flex builder 3, BlazeDS, and Java with Spring and Hibernate framework. I using the remote object to load a string from spring's configuration files. But in testing, I found this fault event like this: RPC Fault faultString="java.lang.NullPointerException" faultCode="Server.Processing" faultDetail="null" I have chec...

LOG4j Spring AOP

Hi. I have a j2ee web application running on Spring framework. I want to implement logging using log4j and Spring's AOP. I was trying to find for references but I only get references which does not use log4j. I had exactly the same configuration as what was on the link you gave. I have declared too a bean which where I want to implement...

Using single spring application context for web app

I'm using org.springframework.web.servlet.DispatcherServlet and org.springframework.ws.transport.http.MessageDispatcherServlet in the same app but each is loading own application context, I need to load all beans in a single application context. The application consists of typical layers web>app>dao etc What I have tried is to use one ...

JMS messaging implementation

I've been struggling with this "simple" task for more expirienced people, I'm stuck for 2 days now need help. I've changed things arround like zillion times now, finally I stumbled upon this spring JMS tutorial. What I want to do, Send a message and receive it. I've been also reading this book chapter 8 on messaging. It really nicely ex...

OpenEjb DeploymentLoader.getWebDescriptors NullPointerException

I am currently getting the following error when I try to startup an EAR that includes OpenEJB. The error is: java.lang.NullPointerException at org.apache.openejb.config.DeploymentLoader.getWebDescriptors(DeploymentLoader.java:1057) at org.apache.openejb.config.DeploymentLoader.discoverModuleType(DeploymentLoader.java:1162) at or...

Junit: Test Spring (auto)wiring with reflection?

Hi, Is it possible to JUnit test if wiring by Spring is succesfully? I would like to do this by reflection. Like: get all beans with id *Controller and test if the fields *services are not null? Thank you! ...

Bind XMLGregorianCalendar field in Spring MVC with velocity

I have a model object with an XMLGregorianCalendar field. How can I bind it to an input field? For string fields I'm using: #springFormInput("model.object.stringfield" "") but can't work out the corresponding code for an XMLGregorianCalendar ...

creating a spring data connection class using ClassPathXmlApplicationContext

I am new to spring and I am currently using ClassPathXmlApplicationContext to getBean inside the controller class. This is a small example application I am building. But what I am trying to do is to move this ClassPathXmlApplicationContext to a new class and keep it static across application. So I can just call the newclass to invoke t...