You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by kalgik <ko...@yahoo.gr> on 2012/05/02 14:49:28 UTC

Re: Problem deploying REST Examples on Eclipse

Hello Anthony.

I followed the steps you provided.
However, I still can not deploy my web applciation on tomEE Web Profile
server.

I receive the following message: *"WARNING: No mappings of FacesServlet
found. Abort initializing MyFaces."*

I checked the 
http://openejb.979440.n4.nabble.com/FacesServlet-is-optional-in-Tomee-td4596836.html
http://openejb.979440.n4.nabble.com/FacesServlet-is-optional-in-Tomee-td4596836.html 
Shall I copy and paste the source code of 
http://svn.apache.org/repos/asf/myfaces/core/trunk/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
http://svn.apache.org/repos/asf/myfaces/core/trunk/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java 
in my Eclipse project?

I created a "Dynamic Web Project in Eclipse".

Regards,
kalgik

--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603106.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

the differences between embedded (unit test) and tomee will be:
0) the packaging will be war instead of jar
1) persistence.xml will go in WEB-INF instead of META-INF

Note: if you take the jar built from this project and put in in <some app
folder>/WEB-INF/lib it shouldn't be far to work in tomee directly ;)

It seems for you maven is blocking, what would you expect? If it is ant i
think running mvn ant:ant should create a build.xml

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/11/14 Jerome <il...@3ds.com>

> Hi guys,
>
> I'm looking for a straigthforward example with REST and TomEE, linked to a
> database.
> I saw your romain but it's with maven, I guess we can run this without
> maven
> or struts.
>
> Kind of ejb project which is called by rest.
> The example  REST on EJB
> <http://openejb.apache.org/examples-trunk/rest-on-ejb/README.html>   is
> quite good, but it's a unit test, I don't get how to make it works in real
> (from a webbrowser).
>
> Anyone has a simple sample of that ?
>
> Thx
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4658594.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by Jerome <il...@3ds.com>.
Hi guys,

I'm looking for a straigthforward example with REST and TomEE, linked to a
database.
I saw your romain but it's with maven, I guess we can run this without maven
or struts.

Kind of ejb project which is called by rest.
The example  REST on EJB
<http://openejb.apache.org/examples-trunk/rest-on-ejb/README.html>   is
quite good, but it's a unit test, I don't get how to make it works in real
(from a webbrowser).

Anyone has a simple sample of that ?

Thx



--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4658594.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
The Eclipse embedded browser had a lot of problems. I receive exceptions if I
used it.
I was relied on it too much.

The paths are working properly from outside browsers (IE, FireFox, Chrome).

kalgik

--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4607989.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i probably missed sthg,

for the test i just copied/pasted the url which appeared in the logs.

for me it was http://localhost:8080/testwebapp/restws/rest-prefix/ejb/ and
http://localhost:8080/testwebapp/restws/rest-prefix/pojo/

- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> The SimpleRESTEJB can be tested from he browser and you can see the result
> of
> its method by clicking the ejb() method.
> Can I also see the result of the SimpleRESTPojo (pojo() )?
>
> kalgik
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4606244.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
The SimpleRESTEJB can be tested from he browser and you can see the result of
its method by clicking the ejb() method.
Can I also see the result of the SimpleRESTPojo (pojo() )?

kalgik



--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4606244.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
what do you mean?

- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> It is ok for me also.
>
> Another question:
> How can I test the pojo part from the browser?
>
> kalgik
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4606101.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
It is ok for me also.

Another question:
How can I test the pojo part from the browser?

kalgik


--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4606101.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
here the project i used:
http://www.2shared.com/file/okCVfypb/openEJBExample3.html (that's a maven
one: mvn package to create the war)

here the war precompiled:
http://www.2shared.com/file/EFv8AQsM/foo-11-SNAPSHOT.html

works fine with the 1.0.0 for me

- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> By the "in the spec it is mentionned that's the correct way to define the
> application class for a servlet container and that the container can use
> other way to discover it." Do I have to do something more which I missed
> it?
>
> Using the web.xml you wrote to me I still receive the same exception
> ""java.lang.NullPointerException
>        sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>       java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>          ..................
>        ...................."
>
> The artifact does not start or contain the word openEJB.
> Unfortunately, I cannot deploy it.
>
> kalgik
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605787.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
By the "in the spec it is mentionned that's the correct way to define the 
application class for a servlet container and that the container can use 
other way to discover it." Do I have to do something more which I missed it?

Using the web.xml you wrote to me I still receive the same exception
""java.lang.NullPointerException 
        sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) 
       java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
         ..................
        ...................."
 
The artifact does not start or contain the word openEJB.
Unfortunately, I cannot deploy it.

kalgik




--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605787.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
in the spec it is mentionned that's the correct way to define the
application class for a servlet container and that the container can use
other way to discover it.

using this web.xml it works:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee"
 xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
 id="WebApp_ID" version="3.0">
  <display-name>openEJBExample3</display-name>


  <servlet>
    <servlet-name>ApplicationConfig</servlet-name>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>ApplicationConfig</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>ApplicationConfig</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>


Can you give a try renaming the deployed artifact (.war or exploded folder)
with a name not starting with openejb please?

- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> I tested both of them.
> If I add the servlet part you recommended to me but I receive the following
> error:
> "java.lang.NullPointerException
>        sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>        java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1626)
>
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
>
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:461)
>
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>
>  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>
>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
>
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
>
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
>
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        java.lang.Thread.run(Thread.java:662)
> "
> But the ApplicationConfig is not a servlet, isn't it?
>
> I added the system property to the Run Configuration without result.
>
> Can you please send to me your project which is working?
>
> kalgik
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605714.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
I tested both of them. 
If I add the servlet part you recommended to me but I receive the following
error:
"java.lang.NullPointerException
	sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	java.lang.ClassLoader.loadClass(ClassLoader.java:248)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1626)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)

org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:461)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)

org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)

java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:662)
"
But the ApplicationConfig is not a servlet, isn't it?

I added the system property to the Run Configuration without result.

Can you please send to me your project which is working?

kalgik


--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605714.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you try either adding to your web.xml:

  <servlet>
    <servlet-name>ApplicationConfig</servlet-name>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>ApplicationConfig</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>ApplicationConfig</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

or adding the system property "-Dtomee.jaxrs.deploy.undeclared=true"


- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> I have uploaded at
> https://github.com/downloads/kalgik/tomEE_Projects/openEJBExample3.rar
>
> I tested with Java 1.6 and Java 1.7.
>
> kalgik
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605537.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
I have uploaded at
https://github.com/downloads/kalgik/tomEE_Projects/openEJBExample3.rar

I tested with Java 1.6 and Java 1.7.

kalgik

--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605537.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hmm,

i don't see why it can't work, can you upload it to a public place please?
(the best for us is a goodle code or github account)

- Romain


2012/5/3 kalgik <ko...@yahoo.gr>

> The annotations I had are:
> @ApplicationPath("/restws/rest-prefix") for the ApplicationConfig
> @Path("/ejb") for the SimpleRESTEJB
> @Path("/pojo") for SimpleRESTPojo
>
> The ApplicationConfig,SimpleRESTEJB and SimpleRESTPojo are in the restws
> package.
> If I change the annotated paths, I received class not found from TomEE plus
> when I deploy the project.
> I receive the "404 Not Found" when I run the application.
>
> Any ideas?
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605497.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
The annotations I had are:
@ApplicationPath("/restws/rest-prefix") for the ApplicationConfig
@Path("/ejb") for the SimpleRESTEJB
@Path("/pojo") for SimpleRESTPojo

The ApplicationConfig,SimpleRESTEJB and SimpleRESTPojo are in the restws
package.
If I change the annotated paths, I received class not found from TomEE plus
when I deploy the project.
I receive the "404 Not Found" when I run the application.

Any ideas?



 

--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4605497.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
"org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces." is
just a warning it is not an issue.

normally simply annotate @Path your service and it should work.

- Romain


2012/5/2 kalgik <ko...@yahoo.gr>

> I used the apache-tomee-1.0.0-plus.zip from
>
> http://www.apache.org/dyn/closer.cgi/openejb/openejb-4.0.0/apache-tomee-1.0.0-plus.zip
>
> http://www.apache.org/dyn/closer.cgi/openejb/openejb-4.0.0/apache-tomee-1.0.0-plus.zip
> .
>
> I followed the instructions for the TomEE installation on Eclipse but
> unfortunately still can not be deployed.
> I created a "Dynamic Web Project" with dynamic web module version = 3.0 (is
> that right?).
>
> Can you please tell me the exact steps I had to follow?
> By the way , I still receive the message
> *"org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
> WARNING: No mappings of FacesServlet found. Abort initializing MyFaces."
> from the TomEE plus. *
>
> kalgik
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603389.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
I used the apache-tomee-1.0.0-plus.zip from 
http://www.apache.org/dyn/closer.cgi/openejb/openejb-4.0.0/apache-tomee-1.0.0-plus.zip
http://www.apache.org/dyn/closer.cgi/openejb/openejb-4.0.0/apache-tomee-1.0.0-plus.zip
.

I followed the instructions for the TomEE installation on Eclipse but
unfortunately still can not be deployed. 
I created a "Dynamic Web Project" with dynamic web module version = 3.0 (is
that right?).

Can you please tell me the exact steps I had to follow? 
By the way , I still receive the message 
*"org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces."
from the TomEE plus. *

kalgik



--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603389.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
apache-tomee-1.0.0-webprofile.zip doesn't support rest or soap services.
Use apache-tomee-1.0.0-plus.zip

- Romain


2012/5/2 kalgik <ko...@yahoo.gr>

> Yes, it still rest service.
> I am using now the tomee-webprofile (apache-tomee-1.0.0-webprofile.zip).
>
> kalgik
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603348.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Problem deploying REST Examples on Eclipse

Posted by kalgik <ko...@yahoo.gr>.
Yes, it still rest service.
I am using now the tomee-webprofile (apache-tomee-1.0.0-webprofile.zip).

kalgik


--
View this message in context: http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603348.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problem deploying REST Examples on Eclipse

Posted by Romain Manni-Bucau <rm...@gmail.com>.
is it still about rest services?

if yes do you use tomee+ or tomee-webprofile?

- Romain


2012/5/2 kalgik <ko...@yahoo.gr>

> Hello Anthony.
>
> I followed the steps you provided.
> However, I still can not deploy my web applciation on tomEE Web Profile
> server.
>
> I receive the following message: *"WARNING: No mappings of FacesServlet
> found. Abort initializing MyFaces."*
>
> I checked the
>
> http://openejb.979440.n4.nabble.com/FacesServlet-is-optional-in-Tomee-td4596836.html
>
> http://openejb.979440.n4.nabble.com/FacesServlet-is-optional-in-Tomee-td4596836.html
> Shall I copy and paste the source code of
>
> http://svn.apache.org/repos/asf/myfaces/core/trunk/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
>
> http://svn.apache.org/repos/asf/myfaces/core/trunk/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
> in my Eclipse project?
>
> I created a "Dynamic Web Project in Eclipse".
>
> Regards,
> kalgik
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-tp4582815p4603106.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>