Re: WicketMessage: Can't instantiate page using constructor 'public com.mycompany.StartPage()'. An exception has been thrown during construction!
Thank You very much!! :) -- 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-tp4677445p4677447.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
Re: WicketMessage: Can't instantiate page using constructor 'public com.mycompany.StartPage()'. An exception has been thrown during construction!
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: 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"> 30 WicketSampleEterprise-war org.apache.wicket.protocol.http.WicketFilter applicationClassName com.mycompany.WicketApplication WicketSampleEterprise-war /* //*** Wicket initialization class: public class WicketApplication extends WebApplication{ @Override public Class 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
WicketMessage: Can't instantiate page using constructor 'public com.mycompany.StartPage()'. An exception has been thrown during construction!
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: 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"> 30 WicketSampleEterprise-war org.apache.wicket.protocol.http.WicketFilter applicationClassName com.mycompany.WicketApplication WicketSampleEterprise-war /* //*** Wicket initialization class: public class WicketApplication extends WebApplication{ @Override public Class 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
Re: Can't instantiate page using constructor
That was the only error produced when running build. However, I tried running the server (jetty:run) anyway and found it started and provided a stack trace when I loaded the homepage. That helped me to solve my problem. I had errors outside of wicket, related to hibernate. Thank you, Daniel On Sat, Jan 21, 2012 at 10:26 AM, Per Newgro wrote: > The stack trace is what? > > Am 21.01.2012 18:21, schrieb Daniel Watrous: >> >> When I build my wicket project I'm getting the following error >> >> Tests in error: >> >> homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage): >> Can't instantiate page using constructor 'public >> >> com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' >> and argument ''. Might be it doesn't exist, may be it is not visible >> (public). >> >> I can't see any errors in my code. I am trying to use Hibernate and if >> I comment out the hibernate code then the page compiles fine. I don't >> see how the hibernate code causes an error with the class. Here's my >> code. >> >> package com.danielwatrous.movieratings; >> >> import org.hibernate.Session; >> >> import org.apache.wicket.request.mapper.parameter.PageParameters; >> import org.apache.wicket.markup.html.basic.Label; >> import org.apache.wicket.markup.html.WebPage; >> >> import com.danielwatrous.movieratings.domain.*; >> import com.danielwatrous.movieratings.util.HibernateUtil; >> >> public class HomePage extends WebPage { >> private static final long serialVersionUID = 1L; >> >> public HomePage(final PageParameters parameters) { >> add(new Label("version", >> getApplication().getFrameworkSettings().getVersion())); >> // TODO Add your page's components here >> >> Session session = >> HibernateUtil.getSessionFactory().getCurrentSession(); >> session.beginTransaction(); >> >> Movie movie = new Movie(); >> movie.setName("Ocean's Eleven"); >> movie.setCategory(Category.COMEDY); >> movie.setRating(Rating.FOURSTARS); >> session.save(movie); >> >> session.getTransaction().commit(); >> } >> >> } >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Can't instantiate page using constructor
The stack trace is what? Am 21.01.2012 18:21, schrieb Daniel Watrous: When I build my wicket project I'm getting the following error Tests in error: homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage): Can't instantiate page using constructor 'public com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public). I can't see any errors in my code. I am trying to use Hibernate and if I comment out the hibernate code then the page compiles fine. I don't see how the hibernate code causes an error with the class. Here's my code. package com.danielwatrous.movieratings; import org.hibernate.Session; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.WebPage; import com.danielwatrous.movieratings.domain.*; import com.danielwatrous.movieratings.util.HibernateUtil; public class HomePage extends WebPage { private static final long serialVersionUID = 1L; public HomePage(final PageParameters parameters) { add(new Label("version", getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName("Ocean's Eleven"); movie.setCategory(Category.COMEDY); movie.setRating(Rating.FOURSTARS); session.save(movie); session.getTransaction().commit(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Can't instantiate page using constructor
When I build my wicket project I'm getting the following error Tests in error: homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage): Can't instantiate page using constructor 'public com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public). I can't see any errors in my code. I am trying to use Hibernate and if I comment out the hibernate code then the page compiles fine. I don't see how the hibernate code causes an error with the class. Here's my code. package com.danielwatrous.movieratings; import org.hibernate.Session; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.WebPage; import com.danielwatrous.movieratings.domain.*; import com.danielwatrous.movieratings.util.HibernateUtil; public class HomePage extends WebPage { private static final long serialVersionUID = 1L; public HomePage(final PageParameters parameters) { add(new Label("version", getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName("Ocean's Eleven"); movie.setCategory(Category.COMEDY); movie.setRating(Rating.FOURSTARS); session.save(movie); session.getTransaction().commit(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Error using JUnit: Can't instantiate page using constructor
look at the stacktrace, the root cause is: Caused by: java.lang.ClassCastException: org.apache.wicket.util.tester.WicketTester$DummyWebApplication cannot be cast to com.cheesr.CheesrApplication in your page you are trying to cast application to cheesrapplicatio, but by default wickettester uses its own internal application class, so you should do WicketTester tester=new WicketTester(new CheesrApplication()); -igor On Fri, Apr 4, 2008 at 1:44 PM, PhilipJohnson <[EMAIL PROTECTED]> wrote: > > Greetings, all, > > I am getting started with Wicket and just wrote my first simple JUnit test > for a small Wicket application (taken from the Wicket in Action book). The > test is: > > public class TestIndexPage { > @Test public void labelContainsHelloWorld() { > WicketTester tester = new WicketTester(); > tester.startPage(Index.class); > tester.assertContains("Gouda"); > } > } > > When I run it, I get the following: > > [junit] 407 [main] ERROR org.apache.wicket.RequestCycle - Can't > instantiate page using constructor public com.cheesr.Index() > [junit] org.apache.wicket.WicketRuntimeException: Can't instantiate page > using constructor public com.cheesr.Index() > > I have searched this group but not found any relevant solutions. I am too > new to Wicket to understand how to diagnose this problem. > > I have written a page with a more complete description of my error, > including a link to a .zip file which you can use to reproduce the error > quickly and which includes complete sources at: > > http://code.google.com/p/hackystat-ui-wicket/wiki/WicketJUnitError > > I would be most grateful for any help you could provide. I am a refugee > from the Stripes/Struts/GWT world and am quite excited by the approach taken > in Wicket. > > Thanks very much, > Philip Johnson > -- > View this message in context: > http://www.nabble.com/Error-using-JUnit%3A-Can%27t-instantiate-page-using-constructor-tp16498898p16498898.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error using JUnit: Can't instantiate page using constructor
Greetings, all, I am getting started with Wicket and just wrote my first simple JUnit test for a small Wicket application (taken from the Wicket in Action book). The test is: public class TestIndexPage { @Test public void labelContainsHelloWorld() { WicketTester tester = new WicketTester(); tester.startPage(Index.class); tester.assertContains("Gouda"); } } When I run it, I get the following: [junit] 407 [main] ERROR org.apache.wicket.RequestCycle - Can't instantiate page using constructor public com.cheesr.Index() [junit] org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public com.cheesr.Index() I have searched this group but not found any relevant solutions. I am too new to Wicket to understand how to diagnose this problem. I have written a page with a more complete description of my error, including a link to a .zip file which you can use to reproduce the error quickly and which includes complete sources at: http://code.google.com/p/hackystat-ui-wicket/wiki/WicketJUnitError I would be most grateful for any help you could provide. I am a refugee from the Stripes/Struts/GWT world and am quite excited by the approach taken in Wicket. Thanks very much, Philip Johnson -- View this message in context: http://www.nabble.com/Error-using-JUnit%3A-Can%27t-instantiate-page-using-constructor-tp16498898p16498898.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]