This content has been marked as final. Show 1 reply
Slawomir wrote:Problem better suited for the Glassfish forum: http://www.java.net/forums/glassfish/glassfish
1. Created separate "Dynamic Web Project" application in Eclipse calling via JNDI enterpsise beans from the first app. Although WebService was properly deployed it cannot lookup beans from other
application deployed on Glassfish. It was strange because I used portable JNDI names suggested by Glassfish server. Always got exception "ClassNotFound..." and my lookups from remote clients
worked. After many tries I gave up. (Now I am not sure if calling EJB from another EJB app by WebService app deployed on sam Glassfish server is possible)
2. Thanks to this forum (user "gimbal") I found materials how to implement WebService on existing EJB using JAX-WS (@WebService,@WebMethod annotaions). So I didn't have to createYeah. The joke is that you're more in the territory of JAX-RS (RESTful webservices) in stead of JAX-WS then. JAX-WS is built around SOAP which is XML based. Of course you can return JSON data as a single field and then parse that upon retrieval, but that is just silly engineering.
separate WebService application. I just adjusted one of my EJB with mentioned annotaions. This worked fine but I have problems to force JAX-WS to return data in JSON format not in XML(default).
I needed JSON.
3. I read more abut implementing WebServices in Java and found (I think the most fresh) approach using JAX-RS. JAX-RS uses annotations like: @Path,@GET,@POST,@Produces...etcMake everything part of an EAR; every module in the EAR will or should have access to each others resources through their local interface. On top of that, since JEE6 it is possible to deploy EJBs as part of a WAR; perhaps you don't even need a separate EJB module.
which can turn any class into WebService. The problem is that I cannot access EJB exposed as WebService using JAX-RS because I have no URL path configured.
I have no web.xml file in my Eclipse project where I can configure URL to my EJB. This is because in Eclipse web.xml configuration file is not created for EJB module project - only from Dynamic Web Projects.
I don't know what to do next...
I'm not a Glassfish user myself, I prefer JBoss. I wrote this JBoss 7 startup guide which may interest you:
In there I detail the quest of setting up a WAR project in Eclipse and getting that to deploy and run on a JBoss 7 server, including having EJBs in the war itself. Perhaps seeing the steps I take some things will click in your own Glassfish adventures :)