It sounds like you haven’t registered your facade. Check that you have the com.vaadin.demo.tutorial.addressbook.AddressBookContextListener class and that you are calling
FacadeFactory.registerFacade("mysql", true);
in the contextInitialized method. Note that the addressbook example uses the persistence unit name “default” whereas you use the unit name “mysql”. You need to register your facade with the persistence unit name that you are using.
If you have the context listener implemented, make sure you’ve configured it in your web.xml
Thank you very much for your help,may be I need a little bit of help again to get running.
Okay, I have modified to
FacadeFactory.registerFacade("default", true);
and in persistence.xml the unit-name is default. The persistence file is under src/META-INF.
I am using eclipse ,so there is no error showing on build. But now when I try to run…
http://localhost:8080/AddressBook
wit gives me HTTP 404 error,so it can not locate some resources. where as if I remove the lsitener it loads but gives the previous NULLPointder exception.
AddressBook is my App name created in eclipse.The demo tutorial is added as packages. I have also attached a screen shot image of my workspace if it is for any aid.
Have you tried debugging and setting a break point in the context listener’s contextInitialized() method to see that it actually gets called, if it does, what might be going wrong in there?
This specifies that your database will be dropped and built from scratch each time you restart your server. Once you’ve started the server once, you can change the value to “none” (which means that eclipselink will leave the database untouched when initialized).
20-lug-2010 15.09.24 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class com.vaadin.demo.tutorial.addressbook.AddressBookContextListener
java.lang.NoClassDefFoundError: org/eclipse/persistence/expressions/Expression
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.vaadin.appfoundation.persistence.facade.FacadeFactory.registerFacade(FacadeFactory.java:62)
at org.vaadin.appfoundation.persistence.facade.FacadeFactory.registerFacade(FacadeFactory.java:36)
at com.vaadin.demo.tutorial.addressbook.AddressBookContextListener.contextInitialized(AddressBookContextListener.java:20)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.expressions.Expression
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 23 more
20-lug-2010 15.09.24 org.apache.catalina.core.StandardContext start
GRAVE: Error listenerStart
20-lug-2010 15.09.24 org.apache.catalina.core.StandardContext start
GRAVE: Context
[/AddressBook] startup failed due to previous errors
okay the libraries I have imported are attached to image of my config:
Weird, because obviously it isn’t finding some of the eclipselink classes. Your configuration looks correct, the only thing that was different from my setup is that I
do not have the eclipselink_jpa_modelgen jar in my classpath. I’ll try to look at this more closely and try to replicate the problem once I get home from my trip later this week.