mejorua-api's People
mejorua-api's Issues
API support to IssueTarget
Tasks
- [DONE] Create IssueTargetTO to hold the multiple issue targets data
- Generic target with only text
- UAElement target with typeId and id
- UACharacteristic target with typeId and id
- [DONE] Modify logic until successfully submission of issues
API - POST Issue - Should return the new Issue in JSON
Implement IssueJPADAO with IIssueDAO interface
Original task
- Sprint 4 ElMesa/mejorua#4
- mejorua Issue: ElMesa/mejorua#5 Persistance - API full persitance trough ORM JPA
- mejorua-api Issue: #4 Persistance - API full persitance trough ORM JPA
- Subtask 3: Implement IssueJPADAO with IIssueDAO interface
It was abandoned after various days trying to figure out how to implement it.
Related bugs
Bug on #6 - Exception "NoClassDefFoundError: org/datanucleus/PersistenceConfiguration" on "Persistence.createEntityManagerFactory(...)"
BUG on #6
Original task: #4 subtask .3
Actual task: #6 Implement IssueJPADAO with IIssueDAO interface
Description
In the tomcat deployed API when calling Persistence.createEntityManagerFactory(...) the exception raises.
org.datanucleus.PersistenceConfiguration is suposed to be at the core package of datanucleus
The core package is a pom dependency.
The asociated jar is deployed with all the other dependencies in tomcat under:
- $CATALINA_HOME/webapps/$DEPLOY_NAME/WEB-INF/lib
BUT Sending the same petition again changes the error to a new exception
- java.lang.NoClassDefFoundError: Could not initialize class es.ua.dlsi.mejorua.api.business.IssueBO
This second request exception raises BEFORE even the code line of the first exception.
Most problable cause of exception
CLASSPATH or any other source of jar dependency management at Tomcat runtime (UNKNOWN SOURCE)
First request Exception
HTTP Status 500 - java.lang.NoClassDefFoundError: org/datanucleus/PersistenceConfiguration
type Exception report
message java.lang.NoClassDefFoundError: org/datanucleus/PersistenceConfiguration
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/datanucleus/PersistenceConfiguration
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
root cause
java.lang.NoClassDefFoundError: org/datanucleus/PersistenceConfiguration
org.datanucleus.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:86)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
es.ua.dlsi.mejorua.api.persistance.IssueJPADAO.<init>(IssueJPADAO.java:22)
es.ua.dlsi.mejorua.api.business.IssueBO.<clinit>(IssueBO.java:31)
es.ua.dlsi.mejorua.api.resources.IssueCollection.get(IssueCollection.java:40)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
root cause
java.lang.ClassNotFoundException: org.datanucleus.PersistenceConfiguration
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
org.datanucleus.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:86)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
es.ua.dlsi.mejorua.api.persistance.IssueJPADAO.<init>(IssueJPADAO.java:22)
es.ua.dlsi.mejorua.api.business.IssueBO.<clinit>(IssueBO.java:31)
es.ua.dlsi.mejorua.api.resources.IssueCollection.get(IssueCollection.java:40)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
Second request Exception
HTTP Status 500 - java.lang.NoClassDefFoundError: Could not initialize class es.ua.dlsi.mejorua.api.business.IssueBO
type Exception report
message java.lang.NoClassDefFoundError: Could not initialize class es.ua.dlsi.mejorua.api.business.IssueBO
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class es.ua.dlsi.mejorua.api.business.IssueBO
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
root cause
java.lang.NoClassDefFoundError: Could not initialize class es.ua.dlsi.mejorua.api.business.IssueBO
es.ua.dlsi.mejorua.api.resources.IssueCollection.get(IssueCollection.java:40)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.
Apache Tomcat/7.0.54
Bug on #6 - Exception on tomcat runtime - Class with Meta-Data not enhanced or multiple jdo-api.jar in CLASSPATH
BUG on #6
Original task: #4 subtask .3
Actual task: #6 Implement IssueJPADAO with IIssueDAO interface
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.ExceptionInInitializerError
at es.ua.dlsi.mejorua.api.resources.IssueCollection.get(IssueCollection.java:40)
...
Caused by: org.datanucleus.exceptions.NucleusUserException: Errors were encountered when initialising the specified MetaData. See the nested exceptions for details
at org.datanucleus.metadata.MetaDataManagerImpl.initialiseFileMetaDataForUse(MetaDataManagerImpl.java:1341)
...
Caused by: org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class es.ua.dlsi.mejorua.api.transfer.IssueTO but this class is either not enhanced or you have multiple copies of jdo-api.jar in your CLASSPATH!! Make sure all persistable classes are enhanced before running DataNucleus and/or the CLASSPATH is correct.
at org.datanucleus.metadata.MetaDataManagerImpl.initialiseClassMetaData(MetaDataManagerImpl.java:2705)
Info
On "mvn clean package" the class seems enhanced
[INFO] DataNucleus Enhancer (version 4.0.0.release) for API "JPA"
DataNucleus Enhancer completed with success for 1 classes.
Tasks
- CHECK the output of enchanced class, maybe trough mvn -X clean package or mejorua-api/logs/datanucleus.log
- CHECK this stackoverflow problem. Is not the same but meybe leads to a solution.
IssueBO supports state history
Issue REST API with collection and individual resources (unpersistent)
Tasks
- Data model - IssueBO
- DAO - IssueDAO (unpersistant)
- REST - IssueREST individual resource
- GET - Retrieve Issue
- POST - Update Issue
- REST - IssueREST collection
- GET - Retrieve collection
- POST - Add Issue to collection
Issue resource using GeoJSON Location
Persistance - API full persitance
Tasks
- [DONE] Implement DAO pattern - Actual IssueDAO implimenting IIssue DAO interface
- [DONE] Implement DAO pattern - Separate IssueTO from IssueBO
- [ABANDONED]
Implement IssueJPADAO with IIssueDAO interface- Moved to #6 - Implement IssueJPADAO with IIssueDAO interface
- [DONE] Implement IssueJDBCMySQLDAO with IIssueDAO interface
- Create issue
- GetAll issues
- Update issue (with partial update)
- State
- Cascate - Update event history {IssueEventBO}
- Action
- Term
- Latitude
- Longitude
- State
- Get issue
- [DONE] Implement Singleton DAO Factory to abstract DAO instantiation.
- [DONE] Include SIGUA identifier to Issue model
- BO & TO - Include attribute
- BD - Include field
- First i'll try to do it with JPA 2.1 annotations + Danucleos DB autogeneration
- DAO jdbc MySQL - Update CRUD
Bug - Phonegap requests to API access forbidden (403) when deployed on emulator.
I'll have to check again and research to bring the links.
Problem
Seems that the problem is about the HTTP header "origin: file://...."
Seems that Tomcat 7 his CORS is rejecting the requests generated from the mejorua-smartphone app deployed on the emulator because the are genererd with HTTP headers origin and referer "file://"
Solution
Some links suggested downgrading to tomcat 6 or trying with Jetty, which maybe allow those origin: file:// headers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.