I have a simple Action class which I want to unit test:
package com.gam.action.test;
import org.apache.struts2.StrutsTestCase;
public class HelloWorldActionTest extends StrutsTestCase{
/**
* Test method for {#link com.gam.action.HelloWorldAction#execute()}.
*/
public void testExecute() {
fail("Not yet implemented");
}
}
I've created this test case using JUnit wizard in eclipse. I get the following error when I run the test:
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 230 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:230:-1
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:449)
at org.apache.struts2.util.StrutsTestCaseHelper.initDispatcher(StrutsTestCaseHelper.java:54)
at org.apache.struts2.StrutsTestCase.initDispatcher(StrutsTestCase.java:196)
at org.apache.struts2.StrutsTestCase.setUp(StrutsTestCase.java:182)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:230)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:538)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:509)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:465)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
... 17 more
The problem is I don't know which jar files should be provided. I'm not using spring in my project but if I don't provide spring jar files I get some error and when I provide it I get this one.
What combination of jar files are needed to simply run the test! (As you can see I've degraded my test method to a dummy method.)
The struts2-junit-plugin introduces its own dependencies, shown by this Maven output:
[INFO] +- org.apache.struts:struts2-junit-plugin:jar:2.3.1:compile
[INFO] | +- org.springframework:spring-test:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] | \- junit:junit:jar:4.8.2:compile
It sounds like you're not using Maven, which is almost certainly a Bad Idea. Managing transitive dependencies yourself is not terribly entertaining–save yourself some time and manual labor.
Related
I am a beginner in spring boot and am trying to write a simple spring boot application.
My folder structure is as follows:
-> Project
-> build.gradle
-> settings.gradle
-> src/main/java
-> package
-> Main.java
-> UserController.java
-> UserRespository.java
-> dto
-> User.java
->src/main/resouces
-> application.properties
My build.gradle is as follows :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath(
'org.springframework.boot:spring-boot-gradle- plugin:1.5.6.RELEASE'
)
classpath('mysql:mysql-connector-java:5.1.34')
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile(
'org.springframework.boot:spring-boot-starter-actuator',
'org.springframework.boot:spring-boot-starter-web',
'org.springframework.boot:spring-boot-starter-data-jpa'
)
compile('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
The application.properties is as follows:
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:mysql://localhost:3306/user
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.database=MYSQL
spring.jpa.show-sql = true
My Main.java is as follows:-
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
#SpringBootApplication
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
};
}
I am able to successfully build the application. If I run the application , I get Unable to start application with the following stacktrace:
2017-08-14 20:43:02.976 WARN 27205 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2017-08-14 20:43:02.978 INFO 27205 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2017-08-14 20:43:03.007 INFO 27205 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-08-14 20:43:03.198 ERROR 27205 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.Data Source' that could not be found.
- Bean method 'dataSource' not loaded because #ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because #ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the conditions above or defining a bean of type 'javax.sql.DataSource' in your configuration.
I have checked the dependencies tree and can find both hibernate as well as mysql connector in it.
Have tried removing #EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) , in that case I get Cannot load driver class: com.mysql.jdbc.Driver
You should move the dto package inside into your Main.java class package, In your case it should be like src/main/java/package/dto
So when spring-boot scans, your entity will be visible to the scanner.
Make sure you have added the MySQL driver dependency
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
I am using jersey v2.21 and I am trying to set my ObjectMapper with couple of configurations:
Don't return a property if its value is null
Return the properties of object ordered alphabetically
Return dates in a format like this: 2015-06-22T17:57:05.000-07:00
This how my ObjectMapper looks like:
Edited:
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
/**
* Created by Shiran Maor on 1/13/16.
*/
#Provider
#Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class ObjectMapperResolver implements ContextResolver<ObjectMapper> {
private ObjectMapper defaultMapper;
public ObjectMapperResolver() {
this.defaultMapper = createDefaultMapper();
}
#Override
public ObjectMapper getContext(Class<?> aClass) {
return this.defaultMapper;
}
private static ObjectMapper createDefaultMapper() {
ObjectMapper result = new ObjectMapper();
result = result.configure(SerializationFeature.INDENT_OUTPUT, true);
result = result.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
result = result.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
result.setSerializationInclusion(JsonInclude.Include.NON_NULL);
result.setDateFormat(new ISO8601DateFormat());
return result;
}
}
Edit:
These are my dependencies:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.22.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.21</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
<version>2.21</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.7.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.7.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.7.0</version>
<scope>runtime</scope>
</dependency>
Edit:
This is the tree dependencies:
[INFO] +- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.1.1:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.1.1:compile
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:runtime
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.7:runtime
[INFO] +- org.slf4j:jul-to-slf4j:jar:1.7.7:runtime
[INFO] +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.7:runtime
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- org.mockito:mockito-all:jar:1.9.5:test
[INFO] +- org.jasig.cas.client:cas-client-core:jar:3.2.1:compile
[INFO] +- com.google.code.gson:gson:jar:1.7.1:compile
[INFO] +- org.testng:testng:jar:6.8.8:test
[INFO] | +- org.beanshell:bsh:jar:2.0b4:test
[INFO] | \- com.beust:jcommander:jar:1.27:test
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.4.2:compile
[INFO] +- commons-cli:commons-cli:jar:1.2:runtime
[INFO] +- commons-io:commons-io:jar:1.4:compile
[INFO] +- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- com.thoughtworks.xstream:xstream:jar:1.2.2:provided
[INFO] | \- xpp3:xpp3_min:jar:1.1.4c:provided
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.22.1:runtime
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.22.1:runtime
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.22.1:runtime
[INFO] | | \- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.22.1:runtime
[INFO] | \- org.glassfish.jersey.core:jersey-server:jar:2.22.1:runtime
[INFO] | \- org.glassfish.jersey.core:jersey-client:jar:2.22.1:runtime
[INFO] +- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.21:runtime
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.21:runtime
[INFO] | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.5.4:runtime
[INFO] +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.21:runtime
[INFO] | +- org.glassfish.hk2:hk2-api:jar:2.4.0-b31:runtime
[INFO] | | +- org.glassfish.hk2:hk2-utils:jar:2.4.0-b31:runtime
[INFO] | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b31:runtime
[INFO] | +- org.glassfish.hk2.external:javax.inject:jar:2.4.0-b31:runtime
[INFO] | +- org.glassfish.hk2:hk2-locator:jar:2.4.0-b31:runtime
[INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:runtime
[INFO] | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:runtime
[INFO] +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.2:compile
[INFO] +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.7.0:runtime
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.7.0:runtime
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:jar:2.7.0:runtime
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.7.0:runtime
[INFO] | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
[INFO] | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:provided
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.1.1:test
[INFO] +- org.bouncycastle:bcprov-jdk15:jar:1.45:test
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.11:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:runtime
[INFO] +- com.sun.xml.bind:jaxb-core:jar:2.2.11:runtime
[INFO] +- org.eclipse.persistence:eclipselink:jar:2.6.1:runtime
[INFO] | +- org.eclipse.persistence:javax.persistence:jar:2.1.0:runtime
[INFO] | +- org.eclipse.persistence:commonj.sdo:jar:2.1.1:runtime
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:runtime
[INFO] | \- org.glassfish:javax.json:jar:1.0.4:runtime
[INFO] +- com.sun.xml.bind:jaxb-xjc:jar:2.2.11:runtime
[INFO] \- javax.xml.stream:stax-api:jar:1.0-2:runtime
Edit:
This is my web.xml part:
<servlet>
<servlet-name>api-service-endpoints</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>
com.mypack
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
However, I am getting null values, not alphabetic, and with dates represented in milliseconds.
Update:
After updating the dependencies, I am getting this exception:
<pre>org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.jaxrs.cfg.EndpointConfigBase.<init>(Lcom/fasterxml/jackson/databind/cfg/MapperConfig;)V
org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.anaplan.api.security.auth.AuthenticationFilter.doFilter(AuthenticationFilter.java:63)
</pre>
Update1:
I was reading about depedencies issues that jersey have and when I removed:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.21</version>
<scope>runtime</scope>
</dependency>
I am getting the result as expected, BUT, only in xml, not in json.
any ideas?
Adding this dependency:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22.1</version>
<scope>runtime</scope>
</dependency>
Fixed it.
Add dependency:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>${jackson.version}</version>
</dependency>
Your ObjectMapper works perfectly (with some minor modifications) as long as you're using it correctly (e.g., registering jackson feature and registering your provider in the jax-rs application).
If you substitute MyObjectMapperProvider with your object mapper in the json-jackson example in Jersey (see https://github.com/jersey/jersey/tree/2.x/examples/json-jackson) slightly modified
private static ObjectMapper createDefaultMapper() {
ObjectMapper result = new ObjectMapper();
result = result.configure(SerializationFeature.INDENT_OUTPUT, true);
result = result.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
result = result.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
result.setSerializationInclusion(JsonInclude.Include.NON_NULL);
result.setDateFormat(new ISO8601DateFormat());
return result;
}
it will work just fine.
Entity classes were created in Eclipse using the JPA wizard from an existing MySQL database, but had to remove the #OneToMany annotations because these errors pop up during enhancement (using DataNucleus Enhancer version 3.1.1).
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 40
Exception Details:
Location:
cultivartehidroponia/Order.getOrderItems()Ljava/util/List; #4: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2ab4 004a c600 242a b400 4a2a 07b9 006f
0000010: 0300 9a00 162a b400 4a2a 072a b601 0db9
0000020: 0098 0400 c001 0fb0 2ab6 0056 9900 2e2a
0000030: b400 5a05 32c0 005c 07b6 0079 9a00 1e2a
0000040: b400 5a06 32c0 005c 07b6 0079 9a00 0ebb
0000050: 007b 5913 0111 b700 80bf 2ab6 010d b0
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getDeclaredMethods(Class.java:1855)
at org.datanucleus.metadata.annotations.AbstractAnnotationReader.getJavaBeanAccessorAnnotationsForClass(AbstractAnnotationReader.java:310)
at org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:146)
at org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:171)
at org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:2650)
at org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:496)
at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:734)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)
... 7 more
I can use the entities fine, just without the mapped-by fields.
To bypass this issue, I had to temporarily implement this functionality using transient fields, such as:
#Transient private List<ViewProduct> products;
and simulate the #OneToMany feature manually as:
public List<ViewProduct> getProducts() {
EntityManager em = EMF.get().createEntityManager();
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
this.products = em.createNamedQuery("ViewProduct.findByProductTemplate", ViewProduct.class).setParameter("prodTemplateId", this.getProdTemplateId()).getResultList();
trans.commit();
}...
But this defeats the purpose of having that nice feature... ;(
Maybe a configuration issue? But why does everything else work and not this?
Anyone out there with similar errors? Any recommendations?
Thanks in advance!!!
DataNucleus v3.1 is not supported/developed, and hasn't been for some time. You should use v3.2+, which has at least one fix to JDK 1.7 enhancement.
If you are using Eclipse and Google plug-in, you may need to upgrade the IDE. I was using Indigo with 1.9.4 and I have similar issues with the enhancer. Problem is gone after I switched to Kepler with the associated Google plug-in, etc.
I'm blocked on this problem for many hours and I don't understand the problem as it works fine with another entity of my project.
I created a Java EE project with Glassfish 4, JPA 2 and EJB 3 in Eclipse IDE.
I'm using a mysql database for storing.
I created a entity bean named Company and a DAO to manage it. I did all it needs to work and it works well.
The problem is that I did exactly the same thing for another entity bean, called Newsletter, but this one doesn't work.
Java throws an EJBException, telling me that the abstract schema is unknown, but it exists in the DB.
The tables company and newsletter are in the same db, so I used the same persistence unit for both of them.
Some questions I found on Google or here are solved by adding the class to the persitence-unit and I did it, but it still throws me an exception.
Here is my NEWSLETTER table:
+--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| idNewsletter | int(11) | NO | PRI | NULL | auto_increment |
| firstname | varchar(100) | NO | | NULL | |
| lastname | varchar(100) | NO | | NULL | |
| email | varchar(255) | NO | | NULL | |
+--------------+--------------+------+-----+---------+----------------+
My bean Newsletter:
#Entity
public class Newsletter {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idNewsletter;
#Column(name="firstname")
private String firstname;
#Column(name="lastname")
private String lastname;
#Column(name="email")
private String email;
}
Here is my 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="2lifedb_PU" transaction-type="JTA">
<jta-data-source>jdbc/bonecp_resource</jta-data-source>
<class>com.twolife.beans.User</class>
<class>com.twolife.beans.Company</class>
<class>com.twolife.beans.Office</class>
<class>com.twolife.beans.BankDetails</class>
<class>com.twolife.beans.Logo</class>
<class>com.twolife.beans.Newsletter</class>
<properties>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
And the DAO class:
#Stateless
public class DAONewsletter {
private static final String SQL_SELECT_NEWSLETTER = "SELECT n FROM NEWSLETTER n WHERE n.email = :email";
#PersistenceContext(unitName="2lifedb_PU")
private EntityManager em;
public void create(Newsletter newsletter) throws DAOException {
try {
em.persist(newsletter);
} catch (Exception e) {
throw new DAOException(e);
}
}
public Newsletter find(String email) throws DAOException {
Newsletter newsletter = new Newsletter();
Query query = em.createQuery(SQL_SELECT_NEWSLETTER);
query.setParameter("email", email);
try {
newsletter = (Newsletter) query.getSingleResult();
} catch (NoResultException e) {
return null;
} catch (Exception e) {
throw new DAOException(e);
}
return newsletter;
}
}
And finally, here is the stacktrace of my exception:
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Problem compiling [SELECT n FROM NEWSLETTER n WHERE n.email = :email].
[14, 24] The abstract schema type 'NEWSLETTER' is unknown.
[33, 40] The state field path 'n.email' cannot be resolved to a valid type.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1585)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:456)
at com.twolife.dao.DAONewsletter.find(DAONewsletter.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4667)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4655)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
... 36 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT n FROM NEWSLETTER n WHERE n.email = :email].
[14, 24] The abstract schema type 'NEWSLETTER' is unknown.
[33, 40] The state field path 'n.email' cannot be resolved to a valid type.
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:155)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:347)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:278)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:163)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:142)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:116)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:102)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1583)
... 60 more
If anoyone get an idea, that would be really helpful!
And sorry for some english mistakes, it is not my mother language...
em.createQuery() expects a JPQL query, not a SQL query. SQL and JPQL are not the same language. SQL works with tables and columns. JPQL works with entities, fields/properties and associations. NEVER with table and column names. The syntax is similar, but different.
Your entity is named Newsletter, but your query uses NEWSLETTER. Class names are case sensitive.
I had the same issue in wildfly 10.0 with eclipselink 2.6.
I solved adding the following system property to standalone.xml file
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:4.2">
<system-properties>
<property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/>
</system-properties>
...
</server>
I've created simple project that creates a tree of users in neo4j. Everything works well when I am using standard HTTP protocol. Once I switch to HTTPS application is unable to retrieve any object that has relations. Object looks like this:
#Indexed(indexType=IndexType.SIMPLE, unique=true, indexName="profileIdIDX")
private Long profileId;
// Country where this affiliate exists. -[:LIVESIN]->
#Fetch
#RelatedTo(direction=Direction.OUTGOING,type=RelationTypes.LIVESIN)
private Country country;
// Role of user in affiliate tree
private Integer role;
// Time till this user is eligible to earn affiliate's income
private Long affilElig;
// Time till this user is eligible to earn partner's income
private Long partnElig;
// If user is eligible to get partner's income we need to know his partner level
private Integer partnLvl;
// Direct reference to patron -[:SUPREME]->
#Fetch
#RelatedTo(direction=Direction.OUTGOING, type=RelationTypes.SUPREME)
private Affiliate patron;
// Collection of users registered in affiliate tree in first line of this user <-[:SUPREME]-
#RelatedTo(direction=Direction.INCOMING, type=RelationTypes.SUPREME, elementClass=Affiliate.class)
private Set<Affiliate> subAffilites;
// If user is a VAT payer we do not calculate VAT tax for his income (depends as well on
// country.vatRegime). Possible values are {0=do not calculate, 1=calculate}
#Min(value=0, message="calculateVAT cant be less then 0")
#Max(value=1, message="calculateVAT cant be greather then 1")
private Integer calculateVAT;
When trying to retrieve it through simple repository method:
#Query("start n=node:profileIdIDX(profileId={0}) return n")
public Affiliate findByProfileId(Long profileId);
JSON simply throws this exception:
Error reading as JSON '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /db/data/node/3/https://my.server.com:7473/db/data/node/3/relationships/out/SUPREME. Reason:
<pre> Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</body>
</html>
'" type="java.lang.RuntimeException">java.lang.RuntimeException: Error reading as JSON '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /db/data/node/3/https://my.server.com:7473/db/data/node/3/relationships/out/SUPREME. Reason:
<pre> Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</body>
</html>
'
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
at org.neo4j.rest.graphdb.converter.RelationshipIterableConverter.convertFromRepresentation(RelationshipIterableConverter.java:45)
at org.neo4j.rest.graphdb.ExecutingRestAPI.wrapRelationships(ExecutingRestAPI.java:310)
at org.neo4j.rest.graphdb.ExecutingRestAPI.getRelationships(ExecutingRestAPI.java:480)
at org.neo4j.rest.graphdb.RestAPIFacade.getRelationships(RestAPIFacade.java:197)
at org.neo4j.rest.graphdb.entity.RestNode.getRelationships(RestNode.java:83)
at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getOtherNodes(RelationshipHelper.java:50)
at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getStatesFromEntity(RelationshipHelper.java:153)
at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.createEntitySetFromRelationshipEndNodes(RelationshipHelper.java:127)
at org.springframework.data.neo4j.fieldaccess.RelatedToFieldAccessor.createEntitySetFromRelationshipEndNodes(RelatedToFieldAccessor.java:86)
at org.springframework.data.neo4j.fieldaccess.RelatedToSingleFieldAccessorFactory$RelatedToSingleFieldAccessor.getValue(RelatedToSingleFieldAccessorFactory.java:76)
at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97)
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90)
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40)
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61)
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:252)
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyPropertiesFrom(SourceStateTransmitter.java:57)
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.loadEntity(Neo4jEntityConverterImpl.java:100)
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.read(Neo4jEntityConverterImpl.java:92)
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter.read(Neo4jEntityPersister.java:170)
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.createEntityFromState(Neo4jEntityPersister.java:189)
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.projectTo(Neo4jEntityPersister.java:216)
at org.springframework.data.neo4j.support.Neo4jTemplate.projectTo(Neo4jTemplate.java:197)
at org.springframework.data.neo4j.support.conversion.EntityResultConverter.doConvert(EntityResultConverter.java:68)
at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:43)
at org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:99)
at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:36)
at org.springframework.data.neo4j.rest.SpringRestGraphDatabase$SpringResultConverter.convert(SpringRestGraphDatabase.java:156)
at org.neo4j.rest.graphdb.util.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:98)
at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47)
at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:115)
at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:260)
at org.springframework.data.neo4j.rest.SpringEndResult.singleOrNull(SpringEndResult.java:39)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:108)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:81)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:312)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy38.findByProfileId(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy40.findByProfileId(Unknown Source)
at com.adleritech.test.billing.data.repository.TestAffiliateRepo.test1_persistPatronToGraphDB(TestAffiliateRepo.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader#67ca3da6; line: 1, column: 2]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
... 88 more
I am using Neo4j 1.8.2 enterprise and here is a dependency tree from maven project:
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # billing-data ---
[INFO] com.adleritech.billing:billing-data:jar:1.0-SNAPSHOT
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] | \- asm:asm:jar:3.3.1:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.3.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework.data:spring-data-neo4j-rest:jar:2.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-context:jar:3.1.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-aspects:jar:3.1.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-context-support:jar:3.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.1.4.RELEASE:compile
[INFO] | +- org.neo4j:neo4j-kernel:jar:1.8.1:compile
[INFO] | | \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | +- org.neo4j:neo4j-rest-graphdb:jar:1.8.1:compile
[INFO] | | \- org.neo4j:server-api:jar:1.8.1:compile
[INFO] | | +- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile
[INFO] | | +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | | | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | | | \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] | | \- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] | | \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.7:compile
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.7:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.7:compile
[INFO] | +- com.sun.jersey:jersey-client:jar:1.4:compile
[INFO] | | \- com.sun.jersey:jersey-core:jar:1.4:compile
[INFO] | +- org.neo4j:neo4j:jar:1.8.1:compile
[INFO] | | +- org.neo4j:neo4j-lucene-index:jar:1.8.1:compile
[INFO] | | | \- org.apache.lucene:lucene-core:jar:3.5.0:compile
[INFO] | | +- org.neo4j:neo4j-graph-algo:jar:1.8.1:compile
[INFO] | | +- org.neo4j:neo4j-udc:jar:1.8.1:compile
[INFO] | | +- org.neo4j:neo4j-graph-matching:jar:1.8.1:compile
[INFO] | | \- org.neo4j:neo4j-jmx:jar:1.8.1:compile
[INFO] | +- org.neo4j:neo4j-cypher:jar:1.8.1:compile
[INFO] | | +- org.scala-lang:scala-library:jar:2.9.1-1:compile
[INFO] | | \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.3.1:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- org.springframework.data:spring-data-neo4j:jar:2.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.1.4.RELEASE:compile
[INFO] | +- org.aspectj:aspectjrt:jar:1.7.2:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.5.1.RELEASE:compile
[INFO] | \- org.neo4j:neo4j-cypher-dsl:jar:1.9.M04:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:4.1.0.Final:compile
[INFO] | \- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
[INFO] | \- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:test (scope not updated to compile)
[INFO] \- org.slf4j:slf4j-jdk14:jar:1.6.1:test
Fixed in neo4j-rest-graphdb-1.9.2. There was a hardcoded "http" removed on 6/20/13
https://github.com/neo4j/java-rest-binding/commits/master/src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java