spring

How to define message converter based on url extension in Spring MVC?

How can I influence the process of choosing a message converter in AnnotationMethodHandlerAdapter for resulting POJO by url extension? I would like to have more representations of one data object, while data representation should be chosen by the requested url extension e.g. /users/2.xml or /users/2.json. Current configuration of messag...

SQL_ASCII and Java remote access to PostgreSQL

Hallo, I tried to send the request to PostgreSQL 8.x that has character encoding SQL_ASCII. Sadly I can not convert it to UTF-8 in any way: neither sending connection properties client_encoding=UTF8 using springframework, nor "SET CLIENT_ENCODING = 'UTF8';" directly in jdbc transaction - nothing helps. On setting client encoding in jd...

Transactions not working unless inside DAO

I have a problem with transactions in that annotating a service that calls a DAO with @Transactional throws an exception stating that the Session is not open. The only way I can get it working is by annotating the DAO with @Transactional. What on earth can be happening? This is what I'd like to do but doesn't work: class CustomerServic...

Spring Security, Form Login, and Concurrent Sessions

I am trying to restrict a user from signing more than once (forcing the previous session to expire). I've checked the documentation on the subject here. I've set this up very similar to the documentation, but users are not being restricted to one session at a time. I can log in multiple times (in different browsers) with the same user a...

Two realms in same application with Spring Security?

We're building a web application that is available to both authenticated and anonymous users. If you decide not to register/login you only have a limited set of features. User authentication is done over OpenID with Spring Security. That works fine. However, the application also comes with an admin UI that is deployed at <host>/<context...

Spring MVC 3.0: How do I bind to a persistent object

I'm working with Spring MVC and I'd like it to bind a a persistent object from the database, but I cannot figure out how I can set my code to make a call to the DB before binding. For example, I'm trying to update a "BenefitType" object to the database, however, I want it to get the object fromthe database, not create a new one so I do n...

spring 3 scheduled task running 3 times.

I have a very simple method scheduled to run every 10 seconds like this: @Component public class SimpleTask { @Scheduled(fixedRate=10000) public void first() { System.out.println("Simple Task " + new Date()); } } Config: <task:annotation-driven executor="myExecutor" scheduler="myScheduler" /> <task:executor id="...

Getting a JDBC connection by JNDI in Spring JDBC

This page on Spring JDBC says The DataSourceUtils class … provides static methods to obtain connections from JNDI However the API doc for DataSourceUtils does not include the said static methods, as far as I can see. What am I missing? ...

How to inject the driverClassLoader property in spring?

I have the following partial spring context xml file: <bean name="template" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource" /> </bean> <bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassLoader" value="" /> <!-- T...

Spring Webservices : What should be good starting point ?

Hi, I am totally new to Spring Web Services and so what concept should I start concentrating on and where should I be looking for them and in general what steps would you recommend to get to speed with Spring Webservices Module. Note: I have an requirement to build Web Service for and consume Web Service from different application an...

Autowired dependencies coming back null (Every single one of them)

Hi! Spring seems to resolve and create the autowired objects just fine on boot up. But when I try to access them they come back as null. Anyone have any guesses on what might be going on? Also XML info is blank as I'm only allowed one hyperlink... <beans xmlns="" xmlns:xsi="" xmlns:p="" xmlns:mvc="" xmlns:context="" xsi:...

Spring Security 3: Is it possible to see which AuthenticationProvider has authenticated a session?

I have an AuthenticationManager with multiple AuthenticationProviders. That works very well, the first AP that can auth² the Authentication authenticates the user and if none can, the user is refused. Now I have an a bit more special case, and I need to find out which AuthenticationProvider authenticated a user that was authenticated su...

Authentication with Spring Security with usersByUsernameQuery...

Combination of corporateId and username is unique for us in the user table. I know spring provide a mechanism to write custom query for the authentication. <bean id="authenticationDao" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl"> <property name="dataSource" ref bean="dataSource" /> <property name="usersByUsername...

Storing treecache cluster properties in property file

Hi, I'm using Jboss 4, hibenate, spring and treecache. As we have different environments, I would like to store the cluster information in a separated property file and reference to the content from the treecache xml file. I copied the treecache-optimistic.xml into \jboss-4.2.0.GA\server\Pearl\conf and setup the properties in \jboss...

What is the equivalent of an EJB 3.0 Session Bean in Spring?

Is it as simple as creating a POJO with @Transactional methods? ...

redirecting back to original page after authentication failure with spring security

I'm using Spring 3.0 along with Spring Security. I've always used the following configuration: <form-login login-page="/login" authentication-failure-url="/login?error=credentials" default-target-url="/account" login-processing-url="/security_check"/> So when the user doesn't login correctly, they go to /login. Now I have a logi...

spring 3 mvc multiple application context instances

here is my web.xml: <?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; <!-- Enables clean URLs with JSP views e.g. /welcom...

spring jaxb exception

hi. my code: <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> <map> <entry key="xml" value="#{subscribersXml.contentType}" /> </map> </property> <property name="order" value="0"/> </bean> <bean id="subscribersXml" class="org.springfram...

hibernate many-to-many association and spring hibernatetemplate doesn't work

I am using Spring HibernateTemplate, OpenSessionInViewFilter(actually I extended this class and created my own to switch to FLUSH.AUTO Mode) and Mysql for implementing hibernate many-to-many association. However when I save an object, corresponding many-to-many table's values are not inserted. Does anybody can help me? Thank you. here i...

java.util.zip.ZipException: error in opening zip file

Hi. i am geting this strange exception below: INFO: Deploying web application archive ZangV3Spring.war 10-Sep-2010 08:46:38 org.apache.catalina.startup.ContextConfig init SEVERE: Exception fixing docBase for context [/ZangV3Spring] java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) ...