spring

spring SimpleUrlHandlerMapping to robots.txt

I am using spring frameworking following is the mapping of url to controller <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/controller.web">webController</prop> <prop key="/robots.txt">robotsController</prop> </props> </property> </bean> Whe...

spring property files

Hello all... I need to use the values from the property file... I tried searching it.. What i got is... i need to define a bean of PropertyPlaceHolderConfirguartion under beans.factory.config package of spring framework. But i wish to use it in a pure java class. Depending on a particular value selected, i need to load a particular prope...

update table using spring mvc web and hibernate

hi, I have simple spring mvc web application which can handle simple book store. I have a problem when the existing book is updating. I want to up date title of a book. My updateBook.jsp is somethig like this. <form method="post" action=""> Previous book title : <input type="text" name="previousTitle" /> <br> New book title :<i...

Spring Ldap: Lookup dn without throwing exception if it isn't there

Using LdapTemplate in Spring LDAP, I have this code: Object object=null; try{ String dn = "cn=readers,ou=groups,dc=mycompany, dc=com"; object = this.ldapTemplate.lookup(dn); } catch(final NameNotFoundException e){ // create Object } But since I've read my Joshua Bloch I know that exceptions should not be used for control f...

Controlling inner transaction settings from outer transaction with Spring 2.5

I'm using Spring 2.5 transaction management and I have the following set-up: Bean1 @Transactional(noRollbackFor = { Exception.class }) public void execute() { try { bean2.execute(); } catch (Exception e) { // persist failure in database (so the transaction shouldn't fail) // the exception is not re-thrown } } Bean2 ...

How to display error message in my JSP page using spring security 2.0

Hi I am now using spring security. It works fine. But if login failed, no error message display. I am wondering how can I display error message? I have configured the ResourceBundleMessageSource in my applicationContext.xml <!-- Spring security error message config --> <bean id="messageSource" class="org.springframework.context.sup...

no persistent classes found for query class

Hello friends, I am creating web application using zkoss 5.0.4, Spring 3.0.3, Hibernate 3 and JpA 1.0 with JBOSS 5.1 GA(with jdk support). project compiles fine with JBOSS. But it seems that persitence is not applying for some reason. When I run an application in console it gives following 10:07:35,265 WARN [QuerySplitter] no persis...

Code inside loops does not rollback in Spring Transaction

I'm having the following structure of code in the service class. The problem is in the event of the exception, the transaction only rollback for "insert A()". I'm using spring-ibatis. function save { insert A(); for loop_1() { insert B() insert C() insert D() } for loop_2() { insert E() insert F() --> throws R...

ProxyFactoryBean returning null class object for Target class

Hi I am facing problem in ProxyFactoryBean class, We want to get the class name of the targetBean of the ProxyFactoryBean . When we invoke getType on BeanFactory giving the bean name , it always return as null. Our Java code is public class TestSpring { public static void main(String args[]){ TestSpring ts = new TestSp...

Obtain Hibernate's Configuration in Spring

Hello, My project uses Spring, JPA, and Hibernate, so that all EntityManager's are injected by Spring. I need to access persistent classes' meta data such as column lengths and optionality. The only way I know to obtain this information is through Hibernate's Configuration.getClassMapping(String className). In a pure Hibernate project ...

Spring Framework filter, bean not injected

There are 2 entries for a Servlet Filter, one in web.xml and one in Spring applicationContext.xml I added the filter into applicationContext.xml because I wanted to inject creditProcessor bean into it. The only problem is that the entry in web.xml got picked up by JBoss and then used, so creditProcessor is null. Do I have to use Sprin...

is Hibernate 3.x compatible with Tomcat 5.0.x?

So, I have a godaddy account and I wanted to use it for a small hibernate/spring project... they host java, but they only have the Tomcat 5.0.27 version... would I have to go to a previous version of hibernate or would it work just fine? thanks, Johan ...

Spring MVC form:errors not showing up

Apologies if this question has been asked before. I'm hoping that someone can step in and help me figure out why my form validation errors aren't showing up. I'm using Spring 3.0.3 and Hibernate, and I'm using jsr-303 validation to validate my form inputs. I have a Spring controller that handles GETting a page that contains a form that...

JSF Spring Integration

Hi all, I don't have much experience in J2EE development, but I have just been assigned to a project that uses JSF 1.1 and Spring 2.0. I found that many of our Spring managed service layer classes contain methods that take/return a JSF managed bean. I am wondering if this is good practice, as it seems to tightly couple the service and p...

ViewScoped Bean cause NotSerializableException

Hello I'm using a ViewScoped Bean the Problem is that when call it I get the NotSerializableException. This is the code of my Managed Bean : @ManagedBean(name="demandesBean") @ViewScoped public class DemandesBean implements Serializable { private static final long serialVersionUID = 1L; @ManagedProperty(value="#{demandeService...

Abstract DAO pattern and Spring's "Proxy cannot be cast to ..." problem!

I know this is very often asked , but I cannot find a working solution : This is my AbstractDAO : public interface AbstractDao<T> { public T get(Serializable id); //other CRUD operations } And this is my JPA's implementation: public abstract class AbstractDaoJpaImpl<T> implements AbstractDao<T> , Serializable { protected Entit...

Multi-user Datasources - Spring + Hibernate

Hi, I'm writing a web app that supports multiple users. Each user has their own database - using H2. all database schemas are the same. I wish to use Spring + Hibernate for this application. So I'm stuck at how to associate a user's database with that user - maybe associated it in the HTTPSession, and extend spring's AbstractRoutingDa...

Spring bean name when importing another spring context

Can you enlighten me on this problem I encountered while experimenting with Spring. I have 2 context here. let's name them springA.xml and springB.xml springA.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springfram...

Spring bean fields injection

Using Spring IoC allows to set bean properties exposed via setters: public class Bean { private String value; public void setValue(String value) { this.value = value; } } And the bean definition is: <bean class="Bean"> <property name="value" value="Hello!"> </bean> Is there any existing plugins/classes for S...

Architecture for Spring Webflow 2 bean definitions

I have a project that uses Spring Webflow 2, extensively. There's well over 30 flows, each with a non-trivial number of beans. I've noticed that the application has been slowly gaining in startup time, and after setting the log level to debug and running through the logs, it looks like the problem is the increasing number of flows. To...