Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Ecore Tools » [TEXO] getting started with texo.web.example(exception when starting tomcat)
[TEXO] getting started with texo.web.example [message #1058991] Thu, 16 May 2013 07:13 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
Hello NG!

i tried to get the TEXO example up and running (this is my first web app - i was using RCP till now so be gentle with me Smile )

these are the steps i did to this point. (i documented all my steps as i was not able to find a complete beginner guide on how to get started - and if i get it working i could provide the document to you)
though some of these steps are straight forward some people might run into problems, so i went into details.

Quote:

create a folder JavaEE (in this tutorial i store my data on D:/ so my root is D:/JavaEE/, which i call in future ~), this is where all our java stuff is going to be.
(save your downloads to ~/Downloads/)

goto www.eclipse.org > Downloads > Eclipse IDE for Java EE Developers
start download & when finished extract it to our ~ folder. -> ~/eclipse/

create a folder ~/workspace/

start eclipse and enter your workspace path: ~/workspace/ aka D:/JavaEE/workspace

now we install tomcat to our IDE
first download tomcat from http://tomcat.apache.org/ (i downloaded tomcat 7)
unzip it to ~/tomcat7/ (IMPORTANT be sure there is no apache-tomcat.xxxx folder IN the tomcat7 folder!)

[Window] > [Preferences] > [Server] > [Runtime Environment]
click on [Add...]
Name: Apache Tomcat v7.0
Tomcat installation directory: ~/tomcat7
JRE: workbench default JRE
[Finish]

now we are going to install Texo and its dependencies
[Help] > [Install new Software] -> [Add]
Name: Texo Update Site Interim
Location: http://download.eclipse.org/modeling/emft/texo/updates/interim/
Select all and click [Next >] restart eclipse if needed

Import org.eclipse.emf.texo.web.example (i downloaded the zip file from texo-master repo) (check the "copy projects into workspace" option) (its a plain 'Project')
goto Project | Properties (rightclick in Project Explorer)
enter java build path > Libraries > add external jars goto: ~\eclipse\plugins
and select:
org.eclipse.emf.texo_x.x.x.vxxxxxxxxxxxx.jar
org.eclipse.emf.texo.datagenerator_x.x.x.vxxxxxxxxxxxx.jar
org.eclipse.emf.texo.server_x.x.x.vxxxxxxxxxxxx.jar
goto Order and Export and check the jars above.


all fine till here.
eclipse markers tell me:
Quote:
WARN: Classpath dependency Validator Message (all three jar files will not be exported or published! runtime ClassNotFoundExceptions my result.)
WARN: 93 HTML Problems

ERROR: 1 JavaScript Problem (Unable to retrieve the error message for problem id: 903. Check compiler resources) this is jasmine-html.js
(martin taal wrote that this can be simply ignored)
1 XML Problem - No grammar constraints


as summary this seems fine too!

so i wanted to launch tomcat now. so select ExampleModelBrowserServlet and click on run as -> Run On Server.
there i selected my Tomcat 7 Server and launch it.

so now as all is up and running i go to my webbrowser and test the thing
http://localhost:8080/org.eclipse.emf.texo.web.example/model/library?action=testdata
this returns me
Quote:
Generated 1130 objects
Library: 10
Book: 1010
Writer: 110

HORRAY! or not? i'll test the other sample calls from example page

http://localhost:8080/org.eclipse.emf.texo.web.example/jsonws/Writer -> success

http://localhost:8080/org.eclipse.emf.texo.web.example/jsonws/Writer/1 -> reports me resource not found (probably because i launched the generation not only one time...

so i ignored this one and went to the next one...
http://localhost:8080/org.eclipse.emf.texo.web.example/jsonws?query=select e from Writer e
which shall select me something
this returns me:
{"message":"An exception occurred while creating a query in EntityManager: \r\nException Description: Error compiling the query [select e from Writer e]. Unknown entity type [Writer].","errorClass":"java.lang.IllegalArgumentException","_eclass":"response|ErrorType","cause":{"message":"\r\nException Description: Error compiling the query [select e from Writer e]. Unknown entity type 

this should not happen, right? why does it not know the Writer Entity?

any ideas/help welcome

PS: this question might be trivial for people used to EE, but its a miracle for me coming from the RCP side of java

PPS: this is the full stacktrace of this exception (above is only the json stuff i saw in browser)
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Error compiling the query [select e from Writer e]. Unknown entity type [Writer].
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1477)
	at org.eclipse.emf.texo.server.store.EntityManagerObjectStore.query(EntityManagerObjectStore.java:156)
	at org.eclipse.emf.texo.server.service.RetrieveModelOperation.internalExecute(RetrieveModelOperation.java:76)
	at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
	at org.eclipse.emf.texo.server.web.WebServiceHandler.doGet(WebServiceHandler.java:89)
	at org.eclipse.emf.texo.server.web.WebServiceServlet.doGet(WebServiceServlet.java:57)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.eclipse.emf.texo.server.store.CurrentEntityManagerRequestFilter.doFilter(CurrentEntityManagerRequestFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select e from Writer e]. Unknown entity type [Writer].
	at org.eclipse.persistence.exceptions.JPQLException.entityTypeNotFound(JPQLException.java:483)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTreeContext.classForSchemaName(ParseTreeContext.java:138)
	at org.eclipse.persistence.internal.jpa.parsing.SelectNode.getClassOfFirstVariable(SelectNode.java:327)
	at org.eclipse.persistence.internal.jpa.parsing.SelectNode.getReferenceClass(SelectNode.java:316)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTree.getReferenceClass(ParseTree.java:436)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTree.adjustReferenceClassForQuery(ParseTree.java:75)
	at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:103)
	at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:190)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:142)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:126)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1475)
	... 26 more
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing the query [select * from Writer 1], line 1, column 7: unexpected token [*].
Internal Exception: NoViableAltException(93@[330:16: ( DISTINCT )?])
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1477)
	at org.eclipse.emf.texo.server.store.EntityManagerObjectStore.query(EntityManagerObjectStore.java:156)
	at org.eclipse.emf.texo.server.service.RetrieveModelOperation.internalExecute(RetrieveModelOperation.java:76)
	at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
	at org.eclipse.emf.texo.server.web.WebServiceHandler.doGet(WebServiceHandler.java:89)
	at org.eclipse.emf.texo.server.web.WebServiceServlet.doGet(WebServiceServlet.java:57)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.eclipse.emf.texo.server.store.CurrentEntityManagerRequestFilter.doFilter(CurrentEntityManagerRequestFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: Exception [EclipseLink-8025] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing the query [select * from Writer 1], line 1, column 7: unexpected token [*].
Internal Exception: NoViableAltException(93@[330:16: ( DISTINCT )?])
	at org.eclipse.persistence.exceptions.JPQLException.unexpectedToken(JPQLException.java:372)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.handleRecognitionException(JPQLParser.java:320)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:246)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.reportError(JPQLParser.java:363)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectClause(JPQLParser.java:1139)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectStatement(JPQLParser.java:359)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.document(JPQLParser.java:281)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:134)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:95)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:190)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:142)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:126)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1475)
	... 26 more
Caused by: NoViableAltException(93@[330:16: ( DISTINCT )?])
	at org.eclipse.persistence.internal.libraries.antlr.runtime.DFA.noViableAlt(DFA.java:159)
	at org.eclipse.persistence.internal.libraries.antlr.runtime.DFA.predict(DFA.java:116)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectClause(JPQLParser.java:1062)
	... 35 more
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Error compiling the query [select e from Writer e]. Unknown entity type [Writer].
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1477)
	at org.eclipse.emf.texo.server.store.EntityManagerObjectStore.query(EntityManagerObjectStore.java:156)
	at org.eclipse.emf.texo.server.service.RetrieveModelOperation.internalExecute(RetrieveModelOperation.java:76)
	at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
	at org.eclipse.emf.texo.server.web.WebServiceHandler.doGet(WebServiceHandler.java:89)
	at org.eclipse.emf.texo.server.web.WebServiceServlet.doGet(WebServiceServlet.java:57)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.eclipse.emf.texo.server.store.CurrentEntityManagerRequestFilter.doFilter(CurrentEntityManagerRequestFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select e from Writer e]. Unknown entity type [Writer].
	at org.eclipse.persistence.exceptions.JPQLException.entityTypeNotFound(JPQLException.java:483)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTreeContext.classForSchemaName(ParseTreeContext.java:138)
	at org.eclipse.persistence.internal.jpa.parsing.SelectNode.getClassOfFirstVariable(SelectNode.java:327)
	at org.eclipse.persistence.internal.jpa.parsing.SelectNode.getReferenceClass(SelectNode.java:316)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTree.getReferenceClass(ParseTree.java:436)
	at org.eclipse.persistence.internal.jpa.parsing.ParseTree.adjustReferenceClassForQuery(ParseTree.java:75)
	at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:103)
	at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:190)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:142)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:126)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1475)
	... 26 more
Re: [TEXO] getting started with texo.web.example [message #1059032 is a reply to message #1058991] Thu, 16 May 2013 10:32 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
in the meantime i tried this with my own model.
all fine till the point of data generation. (actually i thought this failed but, when i do not create the database in memory and look with a data manager onto the database it shows me tables, and valid content)

but nothing happens when i call
http://localhost:8080/lumo.example/model/jsonws/Person/37
though there is a person with this ID in the database (checked with Data Source Explorer)

update: i did not forget to register something and now its returning me an error message:
NOTE: i am using the identifiable Eclass, and set it as supertype in the ecore...
java.lang.IllegalStateException: Not possible to determine id eattribute for eClass org.eclipse.emf.ecore.impl.EClassImpl@4cb9b7 (name: Person) (instanceClassName: null) (abstract: false, interface: false)
	at org.eclipse.emf.texo.provider.IdProvider.getCreateIdEAttribute(IdProvider.java:205)
	at org.eclipse.emf.texo.provider.IdProvider.convertIdStringToId(IdProvider.java:142)
	at org.eclipse.emf.texo.server.service.RetrieveModelOperation.internalExecute(RetrieveModelOperation.java:162)
	at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
	at org.eclipse.emf.texo.server.web.WebServiceHandler.doGet(WebServiceHandler.java:89)
	at org.eclipse.emf.texo.server.web.WebServiceServlet.doGet(WebServiceServlet.java:57)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.eclipse.emf.texo.server.store.CurrentEntityManagerRequestFilter.doFilter(CurrentEntityManagerRequestFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

[Updated on: Fri, 17 May 2013 07:26]

Report message to a moderator

Re: [TEXO] getting started with texo.web.example [message #1060141 is a reply to message #1059032] Thu, 23 May 2013 09:41 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
I did not notice your question before. I don't watch the ecoretools forum...

In any case, I updated the wiki to help with this problem, see here:
http://wiki.eclipse.org/Texo/JSON_REST_Web_Services#Annotate_the_id-efeature_for_direct_web-service_calls

Let me know if you have more questions, but if you can answer on the EMF Technology forum that would be quicker!

gr. Martin
Previous Topic:[TEXO] texo skips to generate EOperations from ecore
Next Topic:Texo: list of annoying details
Goto Forum:
  


Current Time: Thu Mar 28 08:37:08 GMT 2024

Powered by FUDForum. Page generated in 0.02634 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top