Hi,
apparently your injection isn't set up correctly, thus managerLocal is null.
Please take a look how the CDI example does it in wicket-examples, e.g.
the following is missing at least:
new CdiConfiguration().configure(this);
Have fun
Sven
On 26.03.2017 17:53, Sokab wrote:
Hi Everyone! I am new and I want to learn to Wicket. When I create new simple
project with Wicket everything is ok but when I try add EJB class to Wicket
(WebPage) always i have this same error:
"WicketMessage: Can't instantiate page using constructor 'public
com.mycompany.StartPage()'. An exception has been thrown during
construction!"
It is my Wicket class:
import javax.ejb.EJB;
import org.apache.wicket.markup.html.WebPage;
public class StartPage extends WebPage{
@EJB
PersonManagerLocal managerLocal;
public StartPage() {
managerLocal.addPerson();
}
}
//*******************************************************
EJB class:
@Stateless
public class PersonManager implements PersonManagerLocal{
@Override
public void addPerson() {
System.out.println("HELLO I AM EJB");
}
//***************************************************************
Interface:
//@Local
public interface PersonManagerLocal {
public void addPerson();
}
//***************************************************************
WEB.xml:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<filter>
<filter-name>WicketSampleEterprise-war</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.mycompany.WicketApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>WicketSampleEterprise-war</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
//***************************************************************
Wicket initialization class:
public class WicketApplication extends WebApplication{
@Override
public Class<? extends WebPage> getHomePage()
{
return StartPage.class;
}
@Override
protected void init(){
super.init();
}
}
I use: Netbeans 8.2, Wicket 7, EJB3.1, wildfly 10
Maybe someone knows what's wrong? Thank you for any advice.
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/WicketMessage-Can-t-instantiate-page-using-constructor-public-com-mycompany-StartPage-An-exception-h-tp4677445.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org