spring

INFO: Additional JARs have been added : 'xalan-2.7.0.jar'

After a successful start of Tomcat and a few REST calls I get this message in Tomcat console and then the application reload it self. And because reload takes a few seconds, response time is too long. And then again - after a REST call I again get this message and it reloads the application again... Google did not help me, can you? :) ...

@Transactional not working with spring and hibernate

I am trying to do spring transactions with @Transactional without any success. Excerpt from my applicationContext.xml: <context:annotation-config /> <context:component-scan base-package="hibex" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="org.postgresql.Driver"...

Spring Injection - Interfaces and Classes

Hi, I want to be able to call Interfaces in my class, but have spring instantiate them with the right implementation class behind the scenes. I.e. Normally you can do: IClass clz = new Class(); I want to have the line IClass clz; preferable in the middle of a method (or as one of the attributes if it can't be done), where clz is in...

Spring App + Tomcat + XSLT = TransformerFactoryConfigurationError

Hi, I am trying to deploy a Spring 3.0 Webapplicatoin to a tomcat5.5 server running on CentOS. Deployment works, but when I try to access the application I get a TransformerFactoryConfigurationError: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.An...

Spring: Programmatically use PropertyPlaceHolderConfigurer on none Singelton Beans

Hi, I'm aware that the following implementation of a PropertyPlaceHolderConfigurer is possible: public class SpringStart { public static void main(String[] args) throws Exception { PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setP...

Spring: PropertyPlaceHolderConfigurer to set values for non-string/integer properties

Hi, All the examples I have seen where the PropertyPlaceHolderConfigurer is used seem to be setting simple values like Strings and ints. How do you use the PPC to set the values of classes. E.g. If i had a class signature Source(String name, DistributionSample batch, DistributionSample delay) How would I go about setting the batch...

What is better for SaaS?

Hello! I want to develop SaaS application, that will be used in small companies. Technologies are: Java, Spring, Struts2. I want to host it on my server. What is the better: develop make one copy and one database for one company, or develop the application that can be used for all in one time and use 1 database? ...

JPA pessimistic locking and JpaTemplate in Spring

Is it possible to use PESIMISTIC lock option using Spring JpaTemplate methods? I know that PESIMISTIC lock can be performed using EntityManager's methods e.g. Account acc = em.find(Account.class, 123); em.lock(acc, PESIMISTIC); ...

Trying to use a grails domain class from the shell

I'm new to Grails. I'm trying to experiement with my grails domains from the shell, and I can't get it to work. These domains work fine from the scaffold code when I run the app. Given this domain class class IncomingCall { String caller_id Date call_time int call_length static constraints = { } } I try to cre...

How to use spring-roo entities from Eclipse RCP/RAP project

I have created a domain model using spring-roo, which makes heavy use of Spring and AspectJ. My model is deploying nicely as a OSGi bundle, and from the Spring STS (eclipse-based) IDE, I can call the entity classes, etc. I need to access these domain classes from a Eclipse RCP/RAP application, and this project I keep in the normal Eclip...

Web application utility class

The following is a utility class that is called by a LoginBean to add and get a User object from a session through FacesContext. The application uses Spring. Should I use an annotation or is it an accepted practise to have static methods in this sort of class? If an annotation is advised, should I use @Component or @Service? // Annotat...

How to write a Spring/JavaEE/web application installer?

I am in the process of converting a legacy system into a Spring JavaEE application and have gotten stuck trying to design the install process. Basically when the application starts up, it needs to check whether the database schema exists and other settings and prompt the user to set them step-by-step until everything is setup. (User is a...

Creating lazily initialized Spring beans using annotation based configuration

I am using Spring's @Component annotation to configure many of the beans in my Spring 3.0 application. I would like to know if it's possible to construct some of these beans lazily - especially the prototype beans? ...

Spring and view resolvers

Hi, is it possible to use InternalResourceViewResolver and BeanNameViewResolver together in the same web app? I mean InternalResourceViewResolver to resolve my jsp. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"/> and instead BeanNameViewResolver to resolve my...

Handling database-related exceptions in Java/Spring

I'm reading the book Spring Recipes right now, and am puzzled by one thing: Any exceptions are thrown as a subclass of DataAccessException, a RuntimeException you're not meant to try/catch. What I'm worried about is problems that are more likely to happen, especially with inserts. If you're using something like SimpleJdbcTemplate each ...

JSF Locale exception

I'm new to JSF and I would like to internationalize my web page so the web site visitor would be able to switch between languages by clicking on flag icons representing each locale. I have edited my faces-config.xml and added resource bundle, default locale, and supported locales. Then I wrote a bean called changeLang.java which is suppo...

How to create dynamic Template String

Is there is any API which replace template string along with values using Spring or java. For example: Dear %FIRST_NAME% %LAST_NAME%, ---- remaining text----------- where parameters (FIRST_NAME, LAST_NAME) in the form of Map. ...

Spring MVC 3: How do I construct a form action restfully?

Given some typical search form, I can't construct this form action when submitting a form: /myapp/orders/${orderId) Because the user is typing in orderId, so I can't include it in the form action. Is there a slick way to do this in Spring MVC 3? What about using an Interceptor to construct this? Is that a good solution? Otherwise I...

Re-use Sitemesh layout

I have a few webapps that I want to reuse an identical layout for. I was hoping I could bootstrap the layout via dependency consumption with the simplest method being: <sitemesh> <property name="decorators-file" value="classpath:path/to/decorators.xml"/> <excludes file="${decorators-file}"/> But that throws an exception. I...

Castor: Creating Mapping Files for Classes that have Abstract attributes

Hi, I have this class: public class Source extends Node { protected DistributionSampler delay ; protected DistributionSampler batchsize ; /** * @param name The name of the source node * @param d The {@link DistributionSampler} used to generate the * inter-arrival times */ public Source( String name, DistributionSamp...