spring

How to pass an object from Spring 3.0 controller to JSP view and test with JSTL

First I have a Spring 3.0 controller with a method similar to the following. I'm passing the view an object named "message" and hoping to print that message via the view if it has been set by the "doStuff" method. @RequestMapping("/index") public ModelAndView doStuff() { ModelAndView mav = new ModelAndView(); Map<String, String...

Duplicate key issue with Spring and Hibernate - assistance needed

--Summary (shortened)-- I have a controller that loads a profile object from the corresponding DAO. It updates some properties, many of them sets, and then calls saveOrUpdate (via save in the DAO) to reattach and update the profile object. At seemingly random intervals, we get an org.hibernate.exception.ConstraintViolationException, w...

Spring Unit/Intergration Testing setup

Hi Guru, I know I am bad, I didn't write unit testing and integration testing for my project. But know I am trying to be a good boy and I am having a hard time setting up the environment. So please help. =) I have my application context under WEB-INF/applicationContext*.xml and in my applicationContext.xml, it has a reference to a prop...

Prevent 503 error from W3.org when Spring tries to load XML files

In short, I'm trying to learn a bit of Spring. Problem is, when I deploy my application, Spring loads XML files and encounters this exception: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/spring-servlet.xml] is invalid; nested exception is oracle.xml...

how to send mail Spring implemention using gmail smtp?

how to send mail Spring implemention using gmail smtp? After executing main method getting exeception Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/FileTypeMap public static void main(String[] args) { JavaMailSenderImpl sender = new JavaMailSenderImpl(); sender.setHost("smtp.gmail.com"); ...

Inject an AntBuilder using Spring?

I have code scattered through a Service in a plugin, using AntBuilder like this: def ant = new AntBuilder() This results in code that is really hard to test I'd like to inject a prototype-scoped AntBuilder that I can replace with a mock. But, I'm pretty much a Spring newbie ... how would I do that? I tried simply putting this in /gra...

Do aspects substitute repositories?

I started experimenting with Spring Roo just recently. It does a very nice job helping one build a domain model with integrated persistence rather quickly. As it adds persistence functionality in aspects, I started think about the following question: Roo adds finders (load an instance of a class from the database which meets variable cr...

Spring 3.0 making JSON response using jackson message converter

i configure my messageconverter as Jackson's then class Foo{int x; int y} and in controller @ResponseBody public Foo method(){ return new Foo(3,4) } from that i m expecting to return a JSON string {x:'3',y:'4'} from server without any other configuration. but getting 404 error response to my ajax request If the method is an...

Creating a wrapper Class

I have two class definitions in my Spring MVC web application named Class and Object respectively: public Class { //instance variables int classId; int className; } public Object { //instance variables int objectId; int objectName; } I also have a service that that returns a list of Class and Object defined as follows. pack...

Servlet Dispatcher throwing exception

I have a simple Spring web flow application created. When the application starts, I get the following error on my Tomcat server: SEVERE: Servlet.service() for servlet dispatcher threw exception java.lang.NoSuchFieldError: WEB_APPLICATION_CONTEXT_ATTRIBUTE at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(Servle...

Getting started with Spring 3 Web MVC - Setting everything up

Hi, I'm trying to get started with JAVA/Eclipse/Spring MVC but can't seem to find a "dummies" or "step-by-step" guide for setting everything up and creating the simplest proof-of-concept application. I found http://static.springsource.org/docs/...-step-by-step/ but there seem to be differences between Spring 2.5 and Spring 3 so i'm loo...

JaxWsProxyFactoryBean for Mule CXF transport?

Hi Everybody I am new to mule. Are there any way to call CXF based web services using JaxWsProxyFactoryBean? It will be nice to reuse Java interface instead of wsdl files. With CXF we can simply reuse our java interface as spring bean for web services client without wsdl2java code generation. <bean id="{Bean Id}" class="org.apache.cxf...

spring freemarker

Hi I am new to freemarker.I have a spring application.In that I am planning to use freemarker.Templates will be stored in database.Based on the login I retrieve template from database.Can any one tell me how to configure the freemarker in spring and get the html tags as a string after constructing the template.I did googling.But I could...

Using Email Template in Spring

I am developing a small utility application emailafriend using Spring. The basic functionality is to email the current url to a friend. As of now I am using a fixed email template which I have hard coded in the class something like - StringBuffer buf = new StringBuffer(form.getSenderName()); buf.append(" want to look at this page: ").ap...

Hibernate boolean true_false yields a char in MySql... sometimes?

I've been enjoying Hibernate's "yes_no" notation for a while now. I use it a lot on active fields like so: @Column(name = "active") @Type(type = "true_false") public boolean getActive() { return active; } public void setActive(boolean active) { this.active = active; } Recently I added a new field called processable, to a dif...

Spring AOP Pointcut syntax for AND, OR and NOT

I'm having trouble with a pointcut definition in Spring (version 2.5.6). I'm trying to intercept all method calls to a class, except for a given method (someMethod in the example below). <aop:config> <aop:advisor pointcut="execution(* x.y.z.ClassName.*(..)) AND NOT execution(* x.y.x.ClassName.someMethod(....

how i use spring and netbeans

can any one tell me how i use spring in netbeans6.8 plz help me....give me one nice tutorial link. ...

Spring builder is slow in Eclipse - can I speed it up?

When building our Java applications in Eclipse, the Spring builder is very slow and gives no status updates. Specifically, I start building a project, and Eclipse's Progress pane displays Invoking 'Spring Project Builder' on 'project name'... for multiple minutes at a time, with no additional details. I've already turned off the ...

Using Spring threading and TaskExecutor, how do I know when a thread is finished?

Alright, possible a naive question here. I have a service that needs to log into multiple network devices, run a command on each and collect the results. For speed, rather than collect the information on each device in sequence, I need to access them all concurrently and consume the results after they are done. Using the Spring framew...

Spring transaction demarcation causes new Hibernate session despite use of OSIV

I'm using Hibernate with OpenSessionInViewInterceptor so that a single Hibernate session will be used for the entire HTTP request (or so I wish). The problem is that Spring-configured transaction boundaries are causing a new session to be created, so I'm running into the following problem (pseudocode): Start in method marked @Transacti...