Hi all,
I am trying to develop a Vaadin Portlet deployed on a Liferay server, using Spring Context and Maven.
However, when I pull in the Beans from the Spring context I get a
java.lang.NullPointerException.
I had a very similar project working on Vaadin 6 (but without using Liferay)
Anyway, here are my properties in the pom.xml
<vaadin.version>7.2.0</vaadin.version>
<org.springframework.version>3.0.0.RELEASE</org.springframework.version>
<org.slf4j-version>1.6.6</org.slf4j-version>
web.xml
<?xml version="1.0"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>My Vaadin portlet</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>VaadinServlet</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VaadinServlet</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
</web-app>
applicationContext.xml
[code]
<?xml version="1.0" encoding="UTF-8"?><context:annotation-config />
<context:component-scan base-package="XXX.XXX.XXXXXXXXX" />
[/code]Finally, a snippet of the MyPortletUI.java class
[code]
public class MyPortletUI extends UI {
private static Log log = LogFactoryUtil.getLog(MyPortletUI.class);
@Override
protected void init(VaadinRequest request) {
SpringContextHelper helper = new SpringContextHelper(VaadinServlet.getCurrent().getServletContext());
[/code]The application fails on line 9 of the MyPortletUI.java class
Some observations:
- The portlet works great without trying to use the SpringContextHelper
- Used the exact code in the Vaadin 7 example for the SpringContextHelper
- I get no errors when deploying the portlet, I can see the beans being created in the console.
Please help!! And let me know if you have any questions.