spring

Why do I get a NullPointerException when initializing Spring

Hi guys, I've got a problem running a batch job on my server, whereas it runs fine from Eclipse on my development workstation. I've got my Spring environment set up using Roo, made an entity, and make a batch that does some work, and test it well on my develompent box. I initialize my context and do the work, but when I run my batch on...

detecting if a file is ready and serving it for download

I have a Spring MVC web application that is generating a report on the server, once the report is generated, I need to enable a button that allows the user to download it. I am not sure how to go about doing this. I figured that I will have to spawn off a thread that will just keep checking for the existence of the file and use javascr...

GWT/Spring/Hibernate data change events and transactions

I'm working on an AJAX application using GWT, Spring and Hibernate. I'm keeping some configuration data on the client side, which is almost never changed, but when it is changed, I have to notify all clients about the changes via a data change event using GWTEventService. All of this is already working, but I noticed a problem concernin...

Add SoapHeader to org.springframework.ws.WebServiceMessage

How can I add an object into the soap header of a org.springframework.ws.WebServiceMessage This is the structure I'm looking to end up with: <soap:Header> <credentials xmlns="http://example.com/auth"&gt; <username>username</username> <password>password</password> </credentials> </soap:Header> ...

problems with enabling spring security in spring mvc

I'm trying to enable Spring Security 2.5 in my spring app but am running into configuration problems. I've followed a few examples and have done what they are doing, but I think something else I have configured is causing problems. Here is my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XML...

How do I get an instance of a Grails service programmatically?

I have an external data source, which will return a string indicating the name of a Grails service to use. What's the syntax to get an instance of this service programatically given the name of the service as a String? ie. given 'GoogleWeather', give me an instance of GoogleWeatherService. Thanks! ...

How to create the file browser in view for spring roo?

I'm new in spring roo. I want to create a page with file upload. I used spring roo to create all pages and i try to use it to create a file browser button in file upload page. The problem is spring roo using spring form tag which doesn't have file browser. I solve this problem by using html input type="file" tag instead, but the sprin...

Switching authentication approaches at runtime with Spring Security?

Typically, when you declare different "<authentication-provider>" for your application (webapp in my case), Spring Security takes care of invoking providers one after another, incase of failure. So, say I have DatabaseAuthenticationProvider and LDAPAuthenticationProvider with DatabaseAuthenticationProvider declared first in the config fi...

Getting a Spring resource

Hello, I'm trying to read a css file with the Resources provided by Spring. My application looks like this: src src/com herer my classes inside packages WebContent WebContent/resources/style/myCSS.css --> the css I want to read WebContent/WEB-INF --> here is my application-context.xml I can get the css and read it by doing some...

Spring automatic binding for dropdown lists for bean properties

Hi, Is there a way to bind beans properties for another type of bean using the spring's form.select. Example: I have a bean that needs to be updated in the view with a property called BeanB: public class BeanA { private BeanB bean; private int id; private void setId(int id){ this.id = id; } private int getId(){ ...

How to run Spring Roo generated tests against a different database to Tomcat?

I have a collection of integration tests that have been generated by Spring Roo for my domain objects (and DAO ITDs). They appear to be fixed to use the "production" applicationContext.xml, which reads the database.properties and connects to the MySQL database schema I have set up for experimenting with the project: privileged aspect A...

Accessing legacy out-of-container instantiated objects from Spring beans

We have a legacy system where something like a Service Locator is used to instantiate and provide all service objects: class ServiceLocator { ServiceA serviceA; ServiceB serviceB; public ServiceLocator () { serviceA = ...; serviceB = ...; } public ServiceA getServiceA() { return serviceA; ...

Spring hibernatetemplate: delete caches?

I'm writing a test to see if my getHibernateTemplate().delete(x) works. Now I've discovered that in a single test there seems to be some caching (my test class extends extends AbstractTransactionalDataSourceSpringContextTests). What I mean is the following. My delete function: does it exist? yes: delete it and return true no: return f...

How do I suppress the 'Returning cached instance of singleton bean' logging message in Spring/Java?

How do I suppress the 'Returning cached instance of singleton bean' logging message in Spring/Java? Is there a good reference for this somewhere? Thanks. ...

Java Spring-Hibernate mapping question?

Say I have domain objects corresponding to Posts and Users. Nevertheless, I have corresponding database tables containing information relevant to "posts" and "users". Currently I have properly set up the mapping in Hibernate so that I can pull the info from the "posts" table and save it as a Post object. However, I then added to my ...

using spring-mvc AbstractExcelView with an already created document

I am trying to use AbstractExcelView to serve an XLS document that I create on a server. Is there a way I can use this with an already constructed workbook? I tried the following but it doesn't work: import java.io.FileInputStream; import java.io.InputStream; import java.util.Map; import javax.servlet.http.HttpServletRequest; import ja...

Calling one DAO from another DAO?

Can this ever make sense? Say I need to fetch an object from the DB which has a relation to another object (represented by a foreign key in the DB, and by a composition in my domain object). If in my first DAO I fetch the data for object 1, then call the dao for object 2, and finally (from within the first DAO, call the setter in objec...

Is it wrong to make every concrete class to inherit from an interface ?

This is in response to certain comments made by Zed Shaw in his blog a long while ago. The experts will then saunter off to implement their Flaming Tower of Babel without any comments, horribly complex mock enabled tests, making sure EVERY SINGLE CLASS HAS AN INTERFACE, and ending every class with “Impl” because, well, th...

Grails LDAP authentication failed

Hi, guys I am developing a web app by using Grails and using Grails LDAP as my Authentication mechanism. However, i always get following error: {Error 500: Cannot pass null or empty values to constructor Servlet: default URI: /ldap-app/j_spring_security_check Exception Message: Cannot pass null or empty values to constructor Caused by:...

Access bean name in custom method interceptor

I want to write bean name and method executed in database so decide to create an custom interceptor. However, I am not able to access the bean name. I found ExposeBeanNameAdvisors may be one of the solution, but not able to find a point to set the name. Anyone have the ideas about this? Many thanks!! ...