spring

How to build a WS with CXF and Spring?

I'm trying to build a WS with CXF. I'm following this article http://www.ibm.com/developerworks/library/ws-pojo-springcxf/ But I have 2 questions: 1) http://stackoverflow.com/questions/3969268/which-maven2-artifacts-are-necessary-to-build-a-ws-with-cxf-and-spring 2) I'm getting this error: FileNotFound: META-INF/cxf/cxf.xml. I don't ...

Problem instantiating generic class bean in Spring

Hi, I'm trying to instantiate a generic class in Spring, but I get following exception: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class football.dao.jpa.GenericJpaDAO]: Common causes of this problem include using a final cla...

Why am I getting JPA LazyInitializationException when using Spring OpenEntityManagerInViewFilter?

My application of OEIV Filter doesn't seem to be getting applied to my Struts actions. I am using Spring 3, Spring Security 3, Struts2, Tiles2 and JPA backed by Hibernate 3. When I try to access a collection for an entity in a struts action, unless the Entity has a fetch type of eager, I am getting a JPA LazyInitializationException. I s...

When to and When not to use IOC/Dependency Injection?

I am working with several Spring MVC web applications and I use the getter/setter dependency injection and configure all my beans in my app-servlet.xml file. I believe that I am following convention with most of the properties and beans that I am injecting into my controller beans such as my DAO's and other beans that I have specified i...

Error creating bean with name 'sessionFactory' : MalformedParameterizedTypeException

ANY advice would be apprecated. I'm stumped... Problem On my laptop, anytime our application tries to load the application-config.xml, I get a java.lang.reflect.MalformedParameterizedTypeException. The EXACT same code works on my desktop and my coworker's desktop/laptop. But on my laptop it throws this error. Since my laptop and des...

Classpath problem: configLocation in Spring

I am having some kind of classpath problem: I've put my context.xml files in META-INF/spring/conf/ They can be perfectly found by Spring using classpath:WEB-META/spring/conf/root-context.xml (root-context.xml references other xml's). My Hibernate.cfg.xml is on src/main/resources, so it 'should' be on the classpath, however Spring does...

How to access HTTP headers in Spring-ws endpoint?

How can I access HTTP headers in Spring-ws endpoint? My code looks like this: public class MyEndpoint extends AbstractMarshallingPayloadEndpoint { protected Object invokeInternal(Object arg) throws Exception { MyReq request = (MyReq) arg; // need to access some HTTP headers here return createMyResp(); } } invoke...

Is Spring ACL a good ACL implementation?

Hi, I have read about Spring ACL but it does not seem to be very competent. For example: 1) No way to list all objects of type X with permission Y 2) No way to automatically create the schemas for new deployments What are you using for ACL? Is it clever to have the ACL so decoupled from the domain model? Thanks, Piotr ...

What's the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

Hello! I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In spring 2.5 I have just used <context:annotation-config /> and <context:component-scan base='...'/> tags declared both in application-cont...

XML Schema reference

I have two XML Schemas. First (A.xsd) is located in a library jar file (mylib.jar) and the second one (B.xsd) is in my project. I want to import A.xsd into the B.xsd and validate incoming XML via Jaxb2Marshaller embedded validator. However I'm unable to make it work properly: it seems that inner XML validator of Jaxb2Marshaller does no...

Hibernate - spring annotated entities not scanned from within jar

Hi, I have a package containing annotated entity classes that I import into my web project. When tomcat deploys the project the entity class that are in the jar are not scanned for annotations. is there a way to tell spring to search for annotated classes inside a jar file? i.e. : <context:component-scan base-package="{path to jar or...

Spring and Hibernate: How to modify user authorities using jsp and checkboxes

I am using spring security and have an admin jsp page for editing user details. I want to be able to grant or revoke authorities on this page. The following checkboxes tag works to display a given user's existing authorities: <form:checkboxes path="authorities" items="${roles}" delimiter="<br />" /> where authorites is an attribute ...

Spring JdbcTemplate ConnectionPooling Configuration

I am working on a Spring MVC application in which I have recently been convinced to revamp my database code. Before I was using very traditional JDBC code that I have been told was very "old school" because of the boilerplate code. I have been making the transition to using JdbcTemplate with Spring. I have configured a bean like shown b...

Why do I get a bad_certificate error when using spring and CXF

I am using CXF generated code to connect to a remote web service over SSL and through a corporate proxy. The code works fine when the connection is established through the Java API and all SSL settings are set as system properties as follows. System.setProperties("https.proxyHost", "myproxy.com"); System.setProperties("https.proxyPort"...

javax.validation.ValidationException: Unable to find default provider

Hi there, I am currently working on Spring MVC web app and trying to hook up validation using the @Valid annotation. When I fire up the application I'm getting the following exception: javax.validation.ValidationException: Unable to find a default provider I have Hibernate Validator 3.1.0.GA on the classpath as well as javax validat...

Question on a specific use case on spring <util:map>

Hi, I'm just trying to explore one use case of using object as a value in a spring map. Here's my example <util:map id="someSourceMap" map-class="java.util.HashMap"> <entry key="source1" value="testLine"/> <entry key="source2" value="testLine2"/> </util:map> <bean id="testLine1" class="com.test.ProductLineMetadata" scope="prototype"> ...

Get parent bean in prototype bean that gets injected

Hi, I would like to have a Bean and a SubBean like this: @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Component public class SubBean implements ApplicationContextAware{ private Object parent; public void setApplicationContext(ApplicationContext ctx){ this.parent = doSomeMagicToGetMyParent(ctx); } public Object getParent(){ ...

Using jQuery to post JSON object to Spring 3 controller

I'm trying to POST a JSON object to a controller in Spring 3. I'm getting the following error: 2010-10-20 17:59:14,391 DEBUG [org.springframework.web.servlet.DispatcherServlet] Could not complete request org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized token 'tilI': was expecting 'nu...

Spring MVC 3, JQuery .ajax url

I am using JQuery ajax in Spring MVC 3. When making the following call, I am running into a dilemma with myurl. On the local development machine, myurl would be localhost:8080/myapp/my_json_controller. On the production, my url would be domain/my_json_controller. I tried using relative url, /my_json_controller, and it would not work ...

JSF Limitations

I'm currently just exploring JSF 2 in the JEE 6 stack. I find quite a bit of limitations with JSF and the way ManagedBeans are used is very counter-intuitive / odd: It seems that, in order to execute an action event, you have to use <h:commandLink> tag. Thats all well if I was for example, posting form data. However in this case, all I...