Namespace error with spring data neo4j - eclipse

i´m currently trying to set up a test project with GWT, Maven, Neo4j and Spring Data.
I ran into a problem when I try to start the project in development mode in eclipse
I alway get the error
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/neo4j]
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/neo4j
http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd">
This is the part of the application-context.xml which gives the error.
In pom.xml I use
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
</dependency>
But I also had the problem with the 2.0.0.Release version.
I found the same error here http://neo4j.org/nabble/#nabble-td3428668
but no answer is provided or if there is a fix.
Does someone have an idea where the problem is?

What is your setup? I guess there is a classloader problem in that the neo4j namespace XML is sitting in another bundle and not accessible to the requesting bundles classloader. Could you put all the SDN jars into one big superbundle to get around this_

Related

spring integration file splitter does not appear on the integration-graph

I have an issue similar to this problem with items missing from the integration graph. In my case I am using Spring Tool Suite (STS) (Version: 3.9.4, Build Id: 201804120850, Platform: Eclipse Oxygen.1a (4.7.1a) with Spring Integration 4.3.15.
I am using a file splitter. It is working correctly, but does not appear on the integration graph.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xsi:schemaLocation="
http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-4.3.xsd
http://www.springframework.org/schema/tool classpath:org/springframework/beans/factory/xml/spring-tool-4.3.xsd
http://www.springframework.org/schema/context classpath:org/springframework/context/config/spring-context-4.3.xsd
http://www.springframework.org/schema/integration classpath:org/springframework/integration/config/spring-integration-4.3.xsd
http://www.springframework.org/schema/integration/stream classpath:org/springframework/integration/stream/config/spring-integration-stream-4.3.xsd
http://www.springframework.org/schema/integration/file classpath:org/springframework/integration/file/config/spring-integration-file-4.3.xsd
http://www.springframework.org/schema/integration/xml classpath:org/springframework/integration/xml/config/spring-integration-xml-4.3.xsd
http://www.springframework.org/schema/integration/mail classpath:org/springframework/integration/mail/config/spring-integration-mail-4.3.xsd">
<int-file:splitter id="15bfileSplitter"
input-channel="PVDR15bChannel"
output-channel="PVDR15bLineChannel" />
This is a bug. Feel free to raise it here: https://github.com/spring-projects/spring-ide/issues

Lookup failed for 'java:comp/BeanManager' when deploying to Glassfish 4

I already made some research on Google and SO but could not find a solution.
I am writing a java ee 7 Web application including Omnifaces and Primefaces using Eclipse. When deploying the application to Glassfish 4, I get the following error:
javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager'
The longer part of the stacktrace is
java.lang.IllegalStateException: javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Error retrieving java:comp/BeanManager [Root exception is java.lang.IllegalStateException: Cannot resolve bean manager]]
at org.omnifaces.util.JNDI.lookup(JNDI.java:87)
at org.omnifaces.config.BeanManager.init(BeanManager.java:76)
at org.omnifaces.config.BeanManager.getReference(BeanManager.java:115)
at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:86)
at javax.faces.application.ApplicationWrapper.createConverter(ApplicationWrapper.java:403)
at org.primefaces.config.ConfigContainer.initConfig(ConfigContainer.java:69)
But I highly doubt that the problem is related to Omnifaces, it's more to state that I didn't do any messy call to cause this.
There is a beans.xml in WEB-INF, it's not completely empty.
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_1.xsd"
bean-discovery-mode="all">
<interceptors>
<class>x.y.z.security.SecurityInterceptor</class>
</interceptors>
</beans>
For the discovery-mode=all, I know it is not recommended, but this is due to an issue I found here: https://java.net/jira/browse/GLASSFISH-20667
If you need more information, facets config or the like, I am happy to post it - but as I've run out of ideas where to locate the problem I don't want to post the everything like complete POM, Glassfish, Eclipse, Maven config or all the code.
edit 2014-01-27:
Ok, after I had written my below comment (the one in comments), I got an idea. Can someone maybe check it out/confirm easily? I was able to load the application to GF after recreating a new database. Can eclipselink cause the above? I am using MS SQL Server 2012, and of course I get SQLExceptions and warnings that tables+fks already exist when redploying, but warnings should not fail my application deployment, should they?
<persistence-unit name="xyzPersistenceUnit" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/xyzDS</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>

Problems with eclipse and maven war plugin overlay

I have a project where I am replacing out the web.xml and other files using a war overlay in maven. Everything works great and then I try to import into eclipse and have all kinds of problems.
To start with I use mvn eclipse:eclipse to generate my Eclipse files. This works but the imported project does not contain the Dynamic Web facet.
Once the Dynamic Web facet (version 2.5) is added, the project still recognizes the deployment descriptor as 2.4 and gives me errors anyway even though it is;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app version="2.5" 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_5.xsd">
Has anyone struggled through this type of thing before?

How to use persistence.xml and hibernate.cfg.xml in JUnit tests via eclipse?

I have been searching for an answer during quite a long time before coming here and ask this question.
My problem is very simple : I cannot run any JUnit test when using the JPA Entity Manager API. It seems that my test is not reading the persistence.xml file.
When I call new Configuration().configure().buildSessionFactory(), it works like a charm but an exception is thrown when calling Persistence.createEntityManagerFactory("myapp") is:
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named myapp at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at com.myapp.Test01.setUpBeforeClass(Test01.java:22)
My JavaSE project has the following structure :
myapp
++src/main/java
++com.myapp.model
++// My entity classes are here
++src/test/java
++com.myapp
++Test01.java
++src/main/resources
++hibernate.cfg.xml
++META-INF
++persistence.xml
and persistence.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="2.0">
<persistence-unit name="myapp" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"></property>
</properties>
</persistence-unit>
</persistence>
Do you have any idea how to solve this issue ?
Thank you very much for your help.
Put the configuration in src/test/resources/META-INF.
My guess would be that org.hibernate.ejb.HibernatePersistence is not on your classpath. That's not in the main Hibernate jar, it's in the hibernate-entitymanager or some such jar.
A couple of quick experiments would be to do, in the code immediately before the call to Persistence.createEntityManagerFactory():
System.out.println(getClass().getResource("META-INF/persistence.xml"));
And:
System.out.println(Class.forName("org.hibernate.ejb.HibernatePersistence"));
It would also be wise to check that Eclipse is copying your resources; do a Project > Clean and then look in your Eclipse build output directory to see if persistence.xml is where you expect. I have sometimes run into cases where Eclipse doesn't copy resources for some reason or other.

Eclipse Helios Java EE 6: Target Unreachable, identifier 'bean' resolved to null

I read through the answers on Java EE 6: Target Unreachable, identifier 'helloBean' resolved to null about identifier being resolved to null. I am facing the similar issue here. My development environment is Eclipse Helios and tomcat 7.0.
I actually have both faces-config.xml and web.xml made compliant to JSF2.0, however, that doesn't solve the issue. It works when I have the faces-config to include the bean. Once I took it off, even though I am having the #ManagedBean annotation, it just doesn't work. I don't see and error or warning in tomcat startup console messages and logs.
Appreciate if anyone can assist.
The faces-config.xml I am using:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<managed-bean>
<managed-bean-name>userManagedBean</managed-bean-name>
<managed-bean-class>UserManagedBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>