Hi all,
Now I am able to deploy the restful web tier without any errors.
The problem is I have created local interface for the ejb and used the same in the web tier. we cannot do that unless both are in the same .ear file.
so, now I have created the remote interface for ejbs and used those in the web tier. Now there is no <ejb-link> at all in the web.xml. and it deployed successfully and I am able to test the restful web services.
Thanks,
Jyothsna
----- Original Message ----
From: Peter Liu <Peter.Liu_at_Sun.COM>
To: users_at_jersey.dev.java.net
Sent: Friday, May 9, 2008 2:21:16 PM
Subject: Re: [Jersey] could not deploy Restful web services whenever I call enterprise beans.
Hi Jyothsna,
Did you add your ejb project as a dependent project to your web project?
You can check this by right-clicking on the Libraries node and select 
Properties to bring up
the project properties dialog. In the dialog, you should see your ejb 
project as a compile-time
library. If not, you can add it by clicking on the "Add Project" button.
I hope this is the problem.
Peter
Jyothsna L wrote:
> Hi ,
>
> I have a problem deploying my restful web application in Netbeans 6.1 .
>
> I have created a Netbeans enterprise application called 
> photocious(similar to delicious that deals with photos)
> In that I have an ejb module and an web module.
>
> The web module(restful) is created with the help of Jersey plugin.
>
> In the ejb module I have created "entity classes from database"(mysql) 
> and "session beans for the entity classes".
> THats it I did not add any code to the generated code.
>
> The below java program(imagesResource.java) belongs to the web 
> module(restful).I am trying to call the enterprise beans in that file.
> Whenever I call an enterprise bean I cannot test/deploy the web 
> module(restful web services). (Error: Unresolved <ejb-link>)
> If I dont call the enterprise bean, I am able to deploy it successfully.
> I have deployed the ejb module successfully on glassfish.I am using 
> TopLink for creating my persistent unit. There are no errors while 
> deploying.
>
>
> I have included the web.xml for the web module in this email. In that 
> file the <ejb-link> is also shown.
> I am guessing the relative path of the 
> photocious4-ejb.jar#imagesFacade might be wrong in <ejb-link>.
> But, I have tried all kinds of paths.
> the below list shows absolute path of required items.
> photocious4-- C:\Documents and Settings\Harish\My 
> Documents\NetBeansProjects\photocious4
> list of items in it
> nbproject
> photocious4-ejb
> photocious4-war
> src
> build.xml
>
> web.xml of web module-- C:\Documents and Settings\Harish\My 
> Documents\NetBeansProjects\photocious4\photocious4-war\web\WEB-INF
>  
> photocious4-ejb.jar -- C:\Documents and Settings\Harish\My 
> Documents\NetBeansProjects\photocious4\photocious4-ejb\dist
>
> i have tried giving 
> ../../photocious4-ejb/dist/photocious4-ejb.jar#imagesFacade in the 
> <ejb-link> of web.xml. But to no avail
>
>
> please help fix the problem.
> please feel free to contact me, if you have any questions in my query.
>
> I have been trying to fix this problem since 5 days, but to no avail. 
> could not find any good help from posts in the forums.
>
> I hope somebody would be able to give a solution for deploying the web 
> module (restful) successfully.
>
> Thanks,
> Jyothsna
>
> -----------------------------------------------------------------------------------------------------------------------------
> photocious-ejb(run=deploy)
>
> init:
> deps-jar:
> compile:
> library-inclusion-in-archive:
> dist:
> pre-run-deploy:
> Checking for missing JDBC drivers ...
> Start registering the project's server resources
> Finished registering server resources
> Undeploying ...
> While undeploying, trying to stop application in target server  
> completed successfully
> While undeploying, trying to remove reference for application in 
> target server  completed successfully
> Undeploying the application
> Trying to undeploy application from domain completed successfully
> Undeployment of application photocious4-ejb  completed successfully
> All operations completed successfully
> In-place deployment at C:\Documents and Settings\Harish\My 
> Documents\NetBeansProjects\photocious4\photocious4-ejb\build\jar
> Start registering the project's server resources
> Finished registering server resources
> moduleID=photocious4-ejb
> deployment started : 0%
> deployment finished : 100%
> Deploying application in domain completed successfully
> Trying to create reference for application in target server  completed 
> successfully
> Trying to start application in target server  completed successfully
> Deployment of application photocious4-ejb  completed successfully
> Enable of photocious4-ejb in target server completed successfully
> Enable of application in all targets  completed successfully
> All operations completed successfully
> post-run-deploy:
> run-deploy:
> run:
> BUILD SUCCESSFUL (total time: 2 seconds)
>
> -----------------------------------------------------------------------------------------------------------------------------
>
> Imagesresource.java
>
> /*
>  *  ImagesResource
>  *
>  * Created on May 9, 2008, 11:40 AM
>  *
>  * To change this template, choose Tools | Template Manager
>  * and open the template in the editor.
>  */
>
> package org.rest.jyothsna;
>
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import javax.ws.rs.core.Context;
> import javax.ws.rs.core.Response;
> import javax.ws.rs.core.UriInfo;
> import javax.ws.rs.POST;
> import javax.ws.rs.ProduceMime;
> import javax.ws.rs.ConsumeMime;
> import javax.ws.rs.Path;
> import javax.ws.rs.GET;
> import org.session.jyothsna.ImagesFacadeLocal;
>
> /**
>  * REST Web Service
>  *
>  * @author Jyo
>  */
>
> @Path("/images")
> public class ImagesResource {
>     @Context
>     private UriInfo context;
>
>     /** Creates a new instance of ImagesResource */
>     public ImagesResource() {
>     }
>
>     /**
>      * Retrieves representation of an instance of 
> org.rest.jyothsna.ImagesResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("application/xml")
>     public String getXml() {
>         //TODO return proper representation object
>         throw new UnsupportedOperationException();
>     }
>
>     /**
>      * POST method for creating an instance of ImagesResource
>      * @param content representation for the new resource
>      * @return an HTTP response with content of the created resource
>      */
>     @POST
>     @ConsumeMime("application/xml")
>     @ProduceMime("application/xml")
>     public Response postXml(String content) {
>         //TODO
>         return Response.created(context.getAbsolutePath()).build();
>     }
>
>     /**
>      * Sub-resource locator method for  {id}
>      */
>     @Path("{id}")
>     public ImageResource getImageResource() {
>         return new ImageResource();
>     }
>
>     private ImagesFacadeLocal lookupImagesFacade() {
>         try {
>             javax.naming.Context c = new InitialContext();
>             return (ImagesFacadeLocal) 
> c.lookup("java:comp/env/ImagesFacade");
>         } catch (NamingException ne) {
>            
> java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, 
> "exception caught", ne);
>             throw new RuntimeException(ne);
>         }
>     }
> }
>
>
> -----------------------------------------------------------------------------------------------------------------------------
> web.xml in the Restful WEB application in Netbeans
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>     <servlet>
>         <servlet-name>ServletAdaptor</servlet-name>
>        
> <servlet-class>com.sun.ws.rest.impl.container.servlet.ServletAdaptor</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ServletAdaptor</servlet-name>
>         <url-pattern>/resources/*</url-pattern>
>     </servlet-mapping>
>     <session-config>
>         <session-timeout>
>             30
>         </session-timeout>
>     </session-config>
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>         </welcome-file-list>
>     <ejb-local-ref>
>         <ejb-ref-name>ImagesFacade</ejb-ref-name>
>         <ejb-ref-type>Session</ejb-ref-type>
>         <local>org.session.jyothsna.ImagesFacadeLocal</local>
>         <ejb-link>photocious4-ejb.jar#ImagesFacade</ejb-link>
>     </ejb-local-ref>
>     </web-app>
>
> -----------------------------------------------------------------------------------------------------------------------------
> photocious.war(run-deploy)
>
>
> init:
> deps-module-jar:
> init:
> deps-jar:
> compile:
> library-inclusion-in-archive:
> dist:
> deps-ear-jar:
> deps-jar:
> library-inclusion-in-archive:
> library-inclusion-in-manifest:
> compile:
> compile-jsps:
> In-place deployment at C:\Documents and Settings\Harish\My 
> Documents\NetBeansProjects\photocious4\photocious4-war\build\web
> Start registering the project's server resources
> Finished registering server resources
> moduleID=photocious4-war
> deployment started : 0%
> Deploying application in domain failed; Error loading deployment 
> descriptors for module [photocious4-war] -- Error: Unresolved 
> <ejb-link>: ../../photocious4-ejb/dist/photocious4-ejb.jar#ImagesFacade
> Deployment error:
> The module has not been deployed.
> See the server log for details.
>         at 
> org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
>         at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
>         at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>         at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at 
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at 
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at 
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at 
> org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
>         at 
> org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
>         at 
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
> Caused by: The module has not been deployed.
>         at 
> org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:160)
>         ... 16 more
> BUILD FAILED (total time: 3 seconds)
>
>
> ------------------------------------------------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try 
> it now. 
> <http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net
      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ