spring

How to send exceptions to exceptionController?

<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="mappedHandlers"> <set> <ref bean="exceptionController" /> </set> </property> <property name="defaultErrorView" value="tiles/content/error" /> </bean> I'm trying to send exceptions to a contro...

ActiveMq integration with Spring 2.5

I am using ActiveMq 5.32 with Spring 2.5.5. I use pretty generic configuration, as long as I include the jmsTransactionManager in DefaultMessageListenerContainer, Spring throw an error on start up: "Error creating bean with name 'org.springframework.jms.listener.DefaultMessageListenerContainer#0'" Without the transactionManager attrib...

self referencing object in JPA

Hello, I am trying to save a SystemUser entity in JPA. I also want to save certain things like who created the SystemUser and who last modified the system User as well. @ManyToOne(targetEntity = SystemUser.class) @JoinColumn private SystemUser userWhoCreated; @Temporal(TemporalType.TIMESTAMP) @DateTimeFormat(iso=ISO.DATE_TIME) private ...

Simple CMS to manage existed project on JAVA (Spring+Hibernate)

Can anybody suggest simple CMS to manage existed project on JAVA (Spring+Hibernate). I need simple CRUD operations for Hibernate Mapping objects (annotations based mapping). ...

How do you setup an gsp snippet in grails and with spring-security-core?

Hi, I have a block of gsp I'd like to reuse and make into a little gsp snippet: <sec:ifLoggedIn> <g:link controller="user" action="showProfile">My Profile</g:link> | <g:link controller="privateMessage" action="list">Inbox</g:link> | <g:link controller="user" action="showPreferences">Preferences</g:link> | <g:link control...

Entity Aspect (in Spring)

Hi guys, I'm having a bit of a problem defining my aspects. I've got a bunch of entities that I'd like to profile the get-methods in, so I've written the following pointcut and method @Pointcut("execution(* tld.myproject.data.entities.*.get*()") public void getEntityProperty() {} @Around("getEntityProperty()") public Object profileGet...

Work manager using thread.sleep or delay doesn't work

Hi all, I used Spring framework and oracle weblogic 10.3 as a container. I used workmanager for manage my thread, I already made one thread that managed by workmanager. Fortunately spring provide the delegation class for using workmanager, so I just need to put it on applicationContext.xml. But when I put the "while" and TimeUnit for sl...

Strange befaviour of spring transaction support for JPA + Hibernate +@Transactional annotation

I found out really strange behavior on relatively simple use case, probably I can't understand it because of not deep knowledges of spring @Transactional nature, but this is quite interesting. I have simple User dao that extends spring JpaDaoSupport class and contains standard save method: @Transactional public User save(User user) { ...

Spring MVC and Jetty: Prevent jsessionid from being used in RedirectView on redirect to external site

In Spring MVC 2.5 with Jetty - probably with any servlet container -, I want to redirect to an external site using RedirectView via the magic "redirect:" prefix for the view name in ModelAndView. Unfortunately, RedirectView uses response.encodeRedirectURL(), so my (otherwiese wanted) session id is appended to the URL. It is not only a ...

Spring 3, Jersey (JSR-311) and Maven dependencies

Hola guys! im currently struggling to integrate a REST Service based on Jersey and Spring. I'm using Spring 3.0.2-RELEASE and jersey-spring 1.2. But jersey-spring adds a dependency to Spring 2.5.6 to my project which of cause conflicts with the 3.0.2-RELEASE to give me thefollwing error: 11:58:25,409 ERROR org.springframework.web.cont...

Testing Spring MVC Output

Hello, So I have an MVC project that exposes my services in JSON format. What would be the ideal method of (unit?) testing whether or not my methods return correct content (in terms of JSON syntax as well)? Thank you, Sammy ...

Resolving views in Spring MVC with Freemarker - including jsp page

When using the FreemarkerServlet, it is possible to include JSP pages alongside Freemarker content. However, I'm using Freemarker as a view resolver in my Spring MVC application and so don't use the FreemarkerServlet. Is there any way I can still use @include_page in my Freemarker templates when I'm not using the FreemarkerServlet? Than...

Exception while allowingTestExecutionListener for JUnit test under Spring

Hi. I have two JUnit tests. Separately,under Eclipse,they ran OK. In case they were ran by mvn clean install command separately (one of the test was disabled),that all were OK also. When both tests are enabled, that mvn clean install failed with stack: 18:37:40,964 ERROR main TestContextManager:258 - Caught exception while allowing...

Spring and JUnit annotated tests: creating fixtures in separate transactions

I am testing my Hibernate DAOs with Spring and JUnit. I would like each test method to start with a pre-populated DB, i.e. the Java objects have been saved in the DB, in a Hibernate transaction that has already been committed. How can I do this? With @After and @Before, methods execute in the same Hibernate transaction as the methods d...

Failed to retrieve "entityManagerFactory" using Geronimo

I have just started studying Spring framework. My current goal is to access database from my bean through JPA (TopLink** provider) on Geronimo server. But I can't overcome the problem of getting entityManagerFactory. The exception I get: java.lang.IllegalStateException: ClassLoader [org.apache.geronimo.kernel.config.MultiParent...

Spring 3 Annotations

I can't get spring annotations to work at all, I'm just trying to get the simplest thing to work... .../mycontext/something -> invokes method: @RequestMapping(value = "/something") @ResponseBody public String helloWorld() { System.out.println("hello world"); return "Hello World"; } My main problem is no matter how hard I try,...

Long running method causing race condition

Hi, I'm relatively new with hibernate so please be gentle. I'm having an issue with a long running method (~2 min long) and changing the value of a status field on an object stored in the DB. The pseudo-code below should help explain my issue. public foo(thing) { if (thing.getStatus() == "ready") { thing.setStatus("finishe...

Spring, Hibernate and Ehcache - Wrong entities

Hi there, I've got a webapp which uses spring+hibernate for my data layer. I'm using 2nd level caching with ehcache as provider. Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm. One of my tables is used for labels within the application - every user who logs access this table wit...

Spring JndiTemplate and parameterized JNDI lookup from context

How can I represent new JndiTemplate(properties).lookup(name), where name is a string variable, in the Spring application context file? Can I express it in a way similar to the following, where the application provides name when it retrieves the bean ID? <util:properties id="applicationProperties" location="classpath:application.pr...

Ibatis startBatch() only works with SqlMapClient's own start and commit transactions, not with Spring-managed ones

Hi, I'm finding that even though I have code wrapped by Spring transactions, and it commits/rolls back when I would expect, in order to make use of JDBC batching when using Ibatis and Spring I need to use explicit SqlMapClient transaction methods. I.e. this does batching as I'd expect: dao.getSqlMapClient().startTransaction(); dao.ge...