2010-11-24 12 views
5

Meine App funktionierte gut bis heute Morgen, aber ich habe die Fehler unten erhalten, nachdem ich meine Netbeans 6.9 umbenannt habe Projekt heute Morgen.Frühjahr 3.0: "Das Präfix" X "für Attribut" Y "verknüpft mit einem Elementtyp" Z "ist nicht gebunden"

Ich erhalte die folgende Fehlermeldung, wenn mein Frühling 3.0.4 app Aufbau:

The prefix "p" for attribute "p:driverClassName" associated with an element type "beans:bean" is not bound 

applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:security="http://www.springframework.org/schema/security" 
    xmlns:p="http://www.springframework.org/schema/p" 
     xmlns:aop="http://www.springframework.org/schema/aop" 
     xmlns:tx="http://www.springframework.org/schema/tx" 

     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
     http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd"> 


    <bean id="myEmf" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> 
     <property name="persistenceUnitName" value="TT-SpringMVCPU"/> 
    </bean> 

    <bean id="configurationLoader" 
     class="org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader"/> 

    <bean id="validator" 
     class="org.springmodules.validation.bean.BeanValidator" 
     p:configurationLoader-ref="configurationLoader" 
     p:errorCodeConverter-ref="errorCodeConverter"/> 

    <bean id="errorCodeConverter" 
     class="org.springmodules.validation.bean.converter.KeepAsIsErrorCodeConverter"/> 
    <bean id="messageSource" 
     class="org.springframework.context.support.ReloadableResourceBundleMessageSource" 
     p:basename="WEB-INF/errors"/> 

    <bean id="TT-SQLServer" 
      class="org.springframework.jdbc.datasource.DriverManagerDataSource" 
      p:driverClassName="net.sourceforge.jtds.jdbc.Driver" 
      p:url="jdbc:jtds:sqlserver://localhost:1234/TTToys" 
      p:username="sa" 
      p:password="Password1" /> 
    </beans> 

application-Sicherheit:

<?xml version="1.0" encoding="UTF-8"?> 

<beans:beans xmlns="http://www.springframework.org/schema/security" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> 


    <http auto-config='true'> 
     <intercept-url pattern="/login" access="IS_AUTHENTICATED_ANONYMOUSLY"/> 
     <intercept-url pattern="/secure/**" access="ROLE_USER" /> 
     <form-login login-page='/login' /> 
    </http> 


    <authentication-manager> 
     <authentication-provider user-service-ref='myUserDetailsService'/> 
    </authentication-manager> 

    <beans:bean id="myUserDetailsService" 
     class="org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl"> 
     <beans:property name="dataSource" ref="TT-SQLServer"/> 
    </beans:bean> 
</beans:beans> 

Die Der obige Fehler verursacht diesen Fehler:

Nov 24, 2010 10:52:54 AM org.springframework.web.context.ContextLoader initWebApplicationContext 
SEVERE: Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEmf' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named TT-SpringMVCPU 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) 
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) 
     at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) 
     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) 
     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) 
     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) 
     at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) 
     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 
     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 
     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) 
     at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637) 
     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:521) 
     at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1359) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297) 
     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) 
     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) 
     at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500) 
     at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:849) 
     at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:351) 
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563) 
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) 
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
     at java.lang.Thread.run(Thread.java:619) 
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named TT-SpringMVCPU 
     at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) 
     at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:92) 
     at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) 
     ... 45 more 

persistence.xml

<?xml version="1.0" encoding="UTF-8"?> 
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
     <persistence-unit name="TT-SpringMVCPU" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> 
     <class>com.sajee.TT.db.Categories</class> 

     <exclude-unlisted-classes>false</exclude-unlisted-classes> 
     <properties> 
      <property name="javax.persistence.jdbc.url" value="jdbc:jtds:sqlserver://localhost:1234/TailSpinToys"/> 
      <property name="javax.persistence.jdbc.password" value="Password1"/> 
      <property name="javax.persistence.jdbc.driver" value="net.sourceforge.jtds.jdbc.Driver"/> 
      <property name="javax.persistence.jdbc.user" value="sa"/> 
     </properties> 
     </persistence-unit> 
    </persistence> 

nichts sehen hier falsch?

+0

Alles sieht gut aus. der Namespace p wird korrekt deklariert und "driverClassName" ist gültiger Setter. Gibt es eine andere Fehlermeldung? – scheffield

+0

@scheffield: aktualisiert die Frage mit einem verwandten Fehler. Dies begann, als ich heute Morgen mein Projekt Netbeans 6.9 umbenannte. – Sajee

+0

Haben Sie jemals überprüft, ob das Problem der P-Namespace ist: indem Sie einfach die alte Schule syntacy für die DriverManagerDataSource anstelle von p: verwenden. - Weil ich nicht glaube, dass der p-Namespace die Ursache für Ihr Problem ist. – Ralph

Antwort

4

Ich habe keine Erfahrung mit Netbeans, aber ich denke, dass das Problem mit XML-Schema für den Namespace p verwandt sein kann.

Es ist eine wilde Vermutung, aber lassen Sie mich es nehmen. Vielleicht hatten Sie Netbeans so konfiguriert, dass eine benutzerdefinierte XSD-Datei zu ihrem Katalog hinzugefügt und auf die XSD-Datei in Ihrem Projekt verwiesen wurde. Nachdem Sie das Projekt umbenannt haben, ist der Pfad zu Namespace-XML-Schema ungültig.

Ich weiß nicht einmal, ob solche XML-Katalogkonfiguration in Netbeans möglich ist, ich bin mehr in Eclipse. Aber ich würde das an deiner Stelle überprüfen.

3

Ich weiß, ich bin spät, aber ich habe denselben Fehler und kann dies für andere nützlich ist .. Ich legte den

p:something 

in

<property name="something" value="anything_you_want_to_set"/> 

Anstatt also

p:driverClassName="net.sourceforge.jtds.jdbc.Driver" 

versuchen Sie dies:

<bean> 
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" /> 
    <!-- and your others property --> 
</bean> 
Verwandte Themen