Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Tomcat + Servlet + EMF
Tomcat + Servlet + EMF [message #658982] Thu, 10 March 2011 15:46 Go to next message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi there,

i am currently trying to put the functionality of project A (a generic Java project which uses EMF) into a servlet B which should be deployed on a Tomcat 6 server. Therefore i have added A to the deployment assemblies of B. Further i added all the EMF plugins to the deployment assemblies of both A and B. However i still get the following exception within plugin A, if i deploy B to the server:

java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/EObject

Could someone give a hint on what i am missing?

Thanks in advance!

Wolf

[Updated on: Thu, 10 March 2011 15:47]

Report message to a moderator

Re: Tomcat + Servlet + EMF [message #659016 is a reply to message #658982] Thu, 10 March 2011 17:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26088
Registered: July 2009
Senior Member
That interface of course comes from org.eclipse.emf.ecore*.jar. It
depends on org.eclipse.emf.common*.jar. Both of those are present? I
know nothing of deployment assemblies so maybe there are other things
you need to do I don't know about...

Wolf Fischer wrote:
> Hi there,
>
> i am currently trying to put the functionality of project A (a generic
> Java project which uses EMF) into a servlet B which should be deployed
> on a Tomcat 6 server. Therefore i have added A to the deployment
> assemblies of B. Further i added all the EMF plugins to the deployment
> assemblies of both A and B. However i still get the following
> exception within plugin A, if i deploy the whole package to the server:
>
> java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/EObject
>
> Could someone give a hint on what i am missing?
>
> Thanks in advance!
>
> Wolf
Re: Tomcat + Servlet + EMF [message #659030 is a reply to message #658982] Thu, 10 March 2011 17:55 Go to previous messageGo to next message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi Ed,

I simply added all org.eclipse.emf.* files from the eclipse / plugin folder in the "Deployment Assembly" configurations (i have WTP installed). As i understood i have to add all those projects / files there which have to be present in the actual deployment file.

Where in your opinion should those files be located? Should i just add those to the built path as external jar files?

Wolf
Re: Tomcat + Servlet + EMF [message #659032 is a reply to message #659030] Thu, 10 March 2011 18:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26088
Registered: July 2009
Senior Member
Wolf,

Are they ending up in the right place in the WAR file?


Wolf Fischer wrote:
> Hi Ed,
>
> I simply added all org.eclipse.emf.* files from the eclipse / plugin
> folder in the "Deployment Assembly" configurations (i have WTP
> installed). As i understood i have to add all those projects / files
> there which have to be present in the actual deployment file.
>
> Where in your opinion should those files be located? Should i just add
> those to the built path as external jar files?
>
> Wolf
>
Re: Tomcat + Servlet + EMF [message #659057 is a reply to message #658982] Thu, 10 March 2011 19:57 Go to previous messageGo to next message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi Ed,

where can i see that? I haven't actually built a WAR file right now. However when i look in the Server view all my project dependencies are listed but not the EMF dependencies...
Where / how would you add the EMF libraries?

Wolf
Re: Tomcat + Servlet + EMF [message #659066 is a reply to message #659057] Thu, 10 March 2011 20:10 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1308
Registered: July 2009
Senior Member
On 3/10/2011 2:57 PM, Wolf Fischer wrote:
> Hi Ed,
>
> where can i see that? I haven't actually built a WAR file right now.
> However when i look in the Server view all my project dependencies are
> listed but not the EMF dependencies...
> Where / how would you add the EMF libraries?
>
> Wolf

For Tomcat servers with default settings, the "assembled" webapp will
appear under
"<workspace> /.metadata/.plugins/org.eclipse.wst.server.core/tmp?/wtpweba pps ".
Under the subdirectory that contains you project's webapp, check the
WEB-INF/lib to see what is there. For details about the Tomcat support
in WTP see the Tomcat FAQ[1].

Cheers,
Larry

[1] http://wiki.eclipse.org/WTP_Tomcat_FAQ
Re: Tomcat + Servlet + EMF [message #659075 is a reply to message #659066] Thu, 10 March 2011 21:42 Go to previous messageGo to next message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi Larry,

thanks for the info!
There are just 3 jar files (one for each of my own projects which i reference from my servlet). All the EMF files are missing... So how do i get them there? Do i have to copy them manually within my webapp-project? Or can i just somehow reference them?

Wolf
Re: Tomcat + Servlet + EMF [message #659080 is a reply to message #659075] Thu, 10 March 2011 21:49 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1308
Registered: July 2009
Senior Member
On 3/10/2011 4:42 PM, Wolf Fischer wrote:
> Hi Larry,
>
> thanks for the info!
> There are just 3 jar files (one for each of my own projects which i
> reference from my servlet). All the EMF files are missing... So how do i
> get them there? Do i have to copy them manually within my
> webapp-project? Or can i just somehow reference them?
>
> Wolf

It probably wouldn't hurt to collect them into some location so they
would be there should you replace or update your Eclipse. If you are
okay with that location being in the project, putting them in the
"WebContent/WEB-INF/lib" folder will automatically include them on your
project's build path and include them when the webapp is "assembled"
during publishing to a Server or exporting as a WAR.

Cheers,
Larry
Re: Tomcat + Servlet + EMF [message #659090 is a reply to message #659080] Thu, 10 March 2011 23:01 Go to previous messageGo to next message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi Larry,

thanks, that helped! (although i would prefer a solution without redundancy).

One more question: I am currently running into some more problems as there are some yet unresolved exceptions (e.g. it doesn't like the java.net.URL.getProtocol() method, at least this one always returns null when running on Tomcat). Are there any tutorials which could help in this transition? My projects weren't designed to run as a servlet but they have to do so now (at least once...).

Cheers

Wolf
Re: Tomcat + Servlet + EMF [message #659202 is a reply to message #659090] Fri, 11 March 2011 14:22 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1308
Registered: July 2009
Senior Member
On 3/10/2011 6:01 PM, Wolf Fischer wrote:
> Hi Larry,
>
> thanks, that helped! (although i would prefer a solution without
> redundancy).
>
> One more question: I am currently running into some more problems as
> there are some yet unresolved exceptions (e.g. it doesn't like the
> java.net.URL.getProtocol() method, at least this one always returns null
> when running on Tomcat). Are there any tutorials which could help in
> this transition? My projects weren't designed to run as a servlet but
> they have to do so now (at least once...).
>
> Cheers
>
> Wolf

What you would need to do would depend on where you are coming from,
which would make the challenge of writing a tutorial a bit open ended.
Communication with the browser will occur using the HttpRequest and
HttpResponse arguments provided when the servlet is called. Be aware
these objects are only valid for the duration of that request being
serviced by the servlet. You can't save them for later use in a
subsequent request.

You might benefit from some general tutorial on servlets. I don't have
one to recommend because my involvement in Tomcat has been sufficient
that I've not needed anything more than the spec documents.
Unfortunately, those documents aren't all that good to to try to learn from.

Cheers,
Larry
Re: Tomcat + Servlet + EMF [message #659208 is a reply to message #659202] Fri, 11 March 2011 14:52 Go to previous message
Wolf Fischer is currently offline Wolf Fischer
Messages: 43
Registered: July 2009
Member
Hi Larry,

Thanks for your answers!

Cheers

Wolf
Previous Topic:Failed to start server, but server is started
Next Topic:XSD Graphical editor
Goto Forum:
  


Current Time: Thu Oct 02 04:39:34 GMT 2014

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

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