Thursday, October 2, 2008

Running JAX-RS/Jersey/JSR311 on weblogic

Please check the bottom of this post for the latest information.

Now that JSR311 has been approved I thought it was time to have a quick go at running a simple hello world service using JDeveloper / Weblogic. These instructions should give you enough of a hint though if you are using Ant/Eclipse or some other tool to build your services. Turns out for weblogic there a few issues to be work around first before you will get a running service.

First of all you need to download some jar files, not quite sure why but the jersey folks seem to go about of there way to make things harder for you if you are not using Maven. You need to follow the "Download" link from the main jersey page. (I can't provide a hyperlink as this page moves with each release, this instructions are based on 0.9). The minimum list of jars you need to run simple services is:

  • jersey-bundle-*.jar
  • jsr311-api.jar
  • asm-*.jar

In JDeveloper create a new library against a project with these three jar files in them. Make sure you mark the library as "Deploy Always". For the moment you wont find these jars in a j2ee server.

In the project you want to create you RESTful services in you need to create a web.xml that contains a reference to the root JAX-RS servlet. This wont be required when we get JEE6; but it doesn't take too much effort to put the extra entries in place. Once you have finished your web.xml will look like:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<web-app 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"
         version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <description>Empty web.xml file for Web Application</description>
    <session-config>
        <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>
    <servlet>
        <display-name>JAX-RS Servlet</display-name>
        <servlet-name>jersey</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
            <param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>project1</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>jersey</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

You need to edit the value for "com.sun.jersey.config.property.packages" to contain a ';' separated list of package names to search. The default configuration class that scans the entire classpath doesn't work on weblogic. Hopefully they will fix this before 1.0 comes out.

So let quickly create a hello world service so we can test things out:

1  package project1;
 2  
 3  import javax.ws.rs.Path;
 4  import javax.ws.rs.GET;
 5  import javax.ws.rs.Produces;
 6  
 7  
 8  @Path("/helloworld")
 9  public class HelloRS {
10   
11      // The Java method will process HTTP GET requests
12      @GET
13      // The Java method will produce content identified by the MIME Media
14      // type "text/plain"
15      @Produces("text/plain")
16      public String getClichedMessage() {
17          // Return some cliched textual content
18          return "Hello World";
19      }
20  }

You have a little bit more work to do to get this working, since JDeveloper doesn't "know" about JAX-RS you have to deploy rather than just run this java file So create a WAR file deployment profile for the project and a EAR file deployment profile that contains the WAR at the application level. Finally create a weblogic-application.xml deployment descriptor for the EAR and add the following text. (In the application navigator go to the "Application Resource Section", then Descriptors->META-INF and the context menu "Create Weblogic Descriptor".

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
  <prefer-application-packages>
    <package-name>org.objectweb.*</package-name>
  </prefer-application-packages>
</weblogic-application>

This makes sure that the version of asm that comes with JAX-RS overrides the one that is built into weblogic. Otherwise you get a method not found error when the service deploys. You should now be able to deploy the service and test using a URL such as "http://localhost:7101/Application1-Project1-context-root/helloworld". The context root and machine/port will of course vary depending on your environment.

You can test this in a web browser, or in JDeveloper you can test using the HTTP Analyzer. View->HTTP Analyzer, Create New Message toolbar button and navigate to the "HTTP Content" tab. Put your URL in at the top and change the method to "GET" rather than the default "POST". Send the message as you should get back "Hello World" in plain text.

Right no time left to play today, back to fixing bugs.

Update 9 Dec '08:

There is an alternative to creating the weblogic-application.xml file that I discovered recently. I wasn't happy with this solution as it affected the entire EAR file. Instead you can create a "weblogic.xml" under WEB-INF that looks like this:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>
</weblogic-web-app>

This has the advantage of only affecting the .war file you are deploying the restful services in. Also I have found out that this problem with the clashing jar files appears to have gone away in the "next" big release of weblogic, but I can't promise you when or even if you will see this fix.

Update 13 Feb 13 '09: With the release of Jersery 1.0.2 you can now download with the basic dependencies, the json libraries and javadoc from the download page. This makes it much easier for non maven users to pick up and use it. Make sure you include both the -server and -core libraries as the -bundle version is not present in the zip.

  • jersey-core-*.jar
  • jersey-server-*.jar
  • jsr311-api-1.0.jar
  • asm-*.jar

Update 24 July '09: You can now download all the core dependencies in one big lump in the jersey-archive take a look at the download page for details.

Update 24 July '09: For weblogic server 10.3.1 aka the R1 release you no longer have to use the "prefer-web-inf-classes" modifier as the namespace in the internal copy of asm has been changed.

Update 12th August '09: (We think this only work for the yet unreleased R11PS1/10.3.2 version) For weblogic server 10.x you can can fix the annotation scanner issue so you no longer have to specify the package location. The failure is caused because ServletContext.getRealPath(...) returns null when you deploy an application as a jar file. You can work around this with the fix for weblogic issue CR299135.

In the simplest case this means your web.xml simplifies to:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<web-app 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"
         version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
        <display-name>JAX-RS Servlet</display-name>
        <servlet-name>jersey</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>jersey</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

You could create a weblogic.xml under META-INF, see similar instructions before as to how to create weblogic-webservices.xml:

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
                  xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
  </container-descriptor>
</weblogic-web-app>

Or make the changes to config.xml mentioned in the CR' above.

Update 1st December '09: Jersey issue 32 has been resolved, if you pull the latest 1.5ea build you should be able to deploy with no workaround. JDeveloper R11 PS1 will unfortunately still create the weblogic.xml automatically; but we can fix this in a future release once 1.5 is production.

Update 11th of March '10: Some final issues, resolved in Jersey 1.1.5.1 specifically for weblogic. Resolved the null pointer in web scanner and some problems with package level filtering that has been reported here.

Update 25 of May '11: Some problems running Jersey with the Oracle XDK in the latest versions of JDeveloper.

31 comments:

  1. I am totally desesperated, I am not able to make it work.

    I have followed all your steps but with eclipse ganymede and I have the following exception:

    Error 500--Internal Server Error

    com.sun.jersey.api.container.ContainerException: [failed to localize] no.root.res.in.res.cfg()
    at com.sun.jersey.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:774)
    at com.sun.jersey.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:671)
    at com.sun.jersey.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:487)


    my class
    package paquete;

    import javax.ws.rs.Path;
    import javax.ws.rs.GET;
    import javax.ws.rs.Produces;


    @Path("/helloworld")
    public class HelloRS {

    // The Java method will process HTTP GET requests
    @GET
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @Produces("text/plain")
    public String getClichedMessage() {
    // Return some cliched textual content
    return "Hello World";
    }
    }

    I can not send you xml because of blogger security.

    Do you know where am I wrong?

    Please help.

    ReplyDelete
  2. Hi,

    To be honest I am not sure and cannot tell you more without your deployment descriptors. I presume you are trying to deploy to weblogic?

    Send me a zip with a ".zipper" file extension to gerard.davison@oracle.com if you want me to take a look. Otherwise try the Jersey mailing lists as people are really helpful there.

    Gerard

    ReplyDelete
  3. Hi creaturita,

    I ran into the same error with [failed to localize] no.root.res.in.res.cfg() but it did work after verifying the web.xml changes. Make sure you have the below param name and values added as part of the jersey init-params:
    param-name: com.sun.jersey.config.property.resourceConfigClass and param-value: com.sun.jersey.api.core.PackagesResourceConfig
    param-name: com.sun.jersey.config.property.packages and
    param-value:${your packages}

    Also make sure you are using the jars from your WEB-INF/lib instead of weblogic. It should work.

    Thanks,
    Steven Lee

    ReplyDelete
  4. Hi, I had the same error [failed to localize] no.root.res.in.res.cfg() with GlassFish v3 preview (JAXRS 1.0.1)

    Solved it by adding the described init param in web.xml
    and adding the commons-lang JAR in WEB-INF/lib.

    Thanks

    Jerome

    ReplyDelete
  5. Hi, I am having the same error:

    com.sun.jersey.api.container.ContainerException: [failed to localize] no.root.res.in.res.cfg()

    I am trying to understand how to remedy from the comments of others, but it is still not clear to me. For the web.xml update, the comments said to put in the following:

    param-name: com.sun.jersey.config.property.resourceConfigClass and param-value: com.sun.jersey.api.core.PackagesResourceConfig
    param-name: com.sun.jersey.config.property.packages and
    param-value:${your packages}

    Is this complete? Do I put something before and after this (init params ??). I am just looking for a complete thing to cut and paste if possible, because I'm not getting the complete solution from the comments. For instance, what exactly do I substitute for "your packages"? Which packages do I put here?

    Is there anything else I need to add in the web.xml, weblogic.xml, etc, to get past this error? Thanks for any help

    ReplyDelete
  6. THC,

    If you follow just the instructions from the last update you can basically just cut and paste those two files into your environment and with the libraries from the archive you are good to go. I have a TODO to tidy up this post, will try to get around to it in a few days.

    Gerard

    ReplyDelete
  7. Gerald, I made my web.xml and weblogic.xml identical to yours (I noticed your update with the screenshots fromm Aug 12) and I am still getting the same exception. I am running WL10.3.1. Again, other than the weblogic.xml and web.xml, I am not creating/editing any other runtime files (i.e. Application.xml, etc.), so I don't know whether there is something else I missed?

    ReplyDelete
  8. THC,

    Okay, can you tell me what platform and what version of Jersey you are using?

    Also what does your jersey class look like?

    Also could you possibly try the 1.1.2EA snapshot as this resolves the problem that is causing you not to see the correct error message. Unfortunately that covers a multitude of sins.

    Thanks, lets try to get this fixed today.

    Gerard

    ReplyDelete
  9. Gerard, I have the following:
    - Windows Vista (development machine)
    - jersey 1.0.3
    - my weblogic 10.3.1 is actually Oracle/Weblogic 11gR1
    - I am deploying from the WL Enterprise Pack (oepe_11.1.1.1.0), which is the Eclipse IDE that comes with the 11gR1 platform. The way that works is you tie into the runtime WL server from the IDE when you build your web app project, and then deploy (and start the WL server) directly from the IDE.
    -As far as "what does my jersey class look like", are you referring to the root resource class? I'll put a generic (can't put actual) version of it inline here:

    package ntm.rs.RootResource;

    import javax.ws.rs.Consumes;
    import javax.ws.rs.GET;
    import javax.ws.rs.POST;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;

    import com.sun.jersey.spi.resource.Singleton;

    @Path("RootResource")
    @Produces("application/xml")
    @Singleton
    public class AppRootResource {


    public AppRootResource () {
    //initialize stuff..
    }

    @GET
    public Something Something() {

    return Something;
    }

    @POST
    @Path("modelUpdate")
    @Consumes("application/xml")
    @Produces("text/html")
    public String updateSomething (Something s) {
    this.setSomething (s);
    return "Something updated";
    }

    @GET
    @Path("dbQuery")
    @Consumes("application/xml")
    @Produces("text/html")
    public String executeQuery() {
    // run query...

    }

    My impression from your blog was that the 1.1.2EA was to address a problem with 1.1.x jersey builds, and I am using 1.0.3 (as I said before). So I am assuming the 1.1.2EA fix does not apply to me?

    Also, I just tried to include my web.xml and weblogic.xml inline here, but it wasn't allowed..

    thanks for your help.

    ReplyDelete
  10. Hi,

    There is a 1.0.3.1 build that fixes the error messages; but it is not available publicly yet.

    It is hard to diagnose you problem otherwise. It is well worth trying with the 1.1.2 build to help. Looking at you code the next most likely error is that "Something" is missing a @XmlRootElement annotation. Can you check for that?

    Gerard

    ReplyDelete
  11. Gerard, I just now replaced all jersey 1.0.3 jars with the jersey 1.1.1 jars (from the jersey site) and get the same error. I don't think its the @XmlRootElement in the Something class, as that is there. I may have failed to mention that This web app deploys and runs fine on tomcat6, in the identical state. Also, slightly incidental to the discussion, because of the @XmlRootElement, I have to include the jax-b jars.

    Finally, I don't understand how to find the 1.1.2 jars to try them. The jersey home has only the 1.0.3 and the 1.1.1. I did find stuff here: http://download.java.net/maven/2/com/sun/jersey/samples/jersey-ejb/1.1.2-ea-SNAPSHOT/

    but I don't understand its structure as, best as I can tell, it does not actually have the 1.1.2 jars anywhere, but source code and xml files and stuff..

    Am I looking in the wrong place for the 1.1.2 jars?

    Also, I tried to put more server log detail in line here, but it wasn't allowed. Thanks

    ReplyDelete
  12. You can download the latest at:

    http://download.java.net/maven/2/com/sun/jersey/jersey-archive/1.1.2-ea-SNAPSHOT/jersey-archive-1.1.2-ea-SNAPSHOT.zip

    This contains Jersey and all the basic dependencies.

    Out of interest what JDK are you using? All of my testing with with JDK 1.6

    Gerard

    ReplyDelete
  13. ok, with 1.1.2ea I at least get different exception. You mentioned earlier about "dependencies". I haven't done anything special as regards dependencies, as it worked fine with tomcat6 without needing to. Here is error:

    com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
    at com.sun.jersey.server.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:783)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:645)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:419)
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:377)
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:242)
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:469)
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:182)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:281)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:442)
    at javax.servlet.GenericServlet.init(GenericServlet.java:241)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:521)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3590)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    Does this clarify at all? thanks

    ReplyDelete
  14. Hmm, very odd.

    The only thing I can suggest is to drop me an email with an example project and war that fails to deploy. My email addr is gerard.davison@oracle.com.

    I will take a look on Monday morning,

    Cheers,

    Gerard

    ReplyDelete
  15. I'm using the Jersey 1.1.5 or Jersey 1.2 and I try to run your example helloworld on weblogic 10.3.1...but when I try to run the example I always get an errorCode:
    <25.1.2010 11:21:06 CET> <[ServletContext@15224558[app:_auto_generated_ear_ module:JAXRSExample path:/JAXRSExample spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@9f586f[
    GET /JAXRSExample/jersey/helloworld HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    Accept-Language: sl
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)
    Connection: Keep-Alive

    ]] Root cause of ServletException.
    java.lang.NullPointerException
    at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:81)
    at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:75)
    at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:69)

    ReplyDelete
  16. Rok,

    Sorry for the late reply. This is due to jersey issue 479:

    https://jersey.dev.java.net/issues/show_bug.cgi?id=479

    This can be fixed either by taking the latest 1.2 build or removing the package level filters from web.xml.

    Gerard

    ReplyDelete
  17. can i use this JAX-RS in a JEE 5 project? I need to create RESTful web service in a Weblogic 10.2

    can u give me an advice for this?

    thanx man :D

    ReplyDelete
  18. Mauricio Galdames,

    It should be okay, if you look at the Jersey install instructions you may need some extra jar files for JDK 1.5.

    Gerard

    ReplyDelete
  19. Hi,

    I am on wls 10.3.2 (11g PS1) and run into this error:

    Caused by: java.lang.NoSuchMethodError: accept
    at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:130)
    at com.sun.jersey.core.spi.scanning.JarFileScanner.scan(JarFileScanner.java:94)
    at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner$1.f(JarZipSchemeScanner.java:76)
    at com.sun.jersey.core.util.Closing.f(Closing.java:68)

    Any idea. I do not use the weblogic.xml (tried it but same problem) and use the servlet initParam to config the packages..

    Any ideas?

    -Tom

    ReplyDelete
  20. Tom,

    Can you tell me what version of Jersey you are using?

    Gerard

    ReplyDelete
  21. Hi Gerard,

    I have developed a sample restful web services application through eclipse. If i am deploying the application to weblogic using eclipse, then its workign fine. But if i create a war file and then deploy it manually using console, then it fails and gives this error. " The default deployment configuration that scans for classes in /WEB-INF/lib and /WEB-INF/classes is not supported for the application server.". I then added the init param as u suggested in ur posts. But now i am getting this error
    com.sun.jersey.api.container.ContainerException: [failed to localize] no.root.res.in.res.cfg().
    Please let me know where i am going wrong. I can also drop u an email with the war file i have created.

    Thanks
    Neha

    ReplyDelete
  22. Also, i have one more question. I need to make a post request to my restful service. Can u please tell me how to pass an object to this POST request as the parameter type is Enity

    Thanks
    Neha

    ReplyDelete
  23. Akhil,

    Are you using the 1.1.5.1 build the noRes error suggests you are using an older build, feel free to drop me the .war file as long as it is not too big.

    Gerard

    ReplyDelete
  24. Akhil,

    Can you give me a little bit more context on your second question?

    Gerard

    ReplyDelete
  25. I trying to run an example where the return type is JSON. I am getting the following error message:

    May 17, 2010 4:52:44 PM com.sun.jersey.spi.container.ContainerResponse write
    SEVERE: A message body writer for Java class services.Product, and Java type class services.Product, and MIME media type application/json was not found
    May 17, 2010 4:52:44 PM com.sun.jersey.spi.container.ContainerResponse traceException
    SEVERE: Mapped exception to response: 500 (Internal Server Error)
    javax.ws.rs.WebApplicationException
    etc......

    I had the example working with a normal string output, now I am trying to get a JSON output.

    ReplyDelete
  26. Hi.

    I can't get this to work. Weblogic 10.0 and jersey 1.0.3

    Still getting error com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

    Web.xml:


    Empty web.xml file for Web Application

    35


    html
    text/html


    txt
    text/plain


    JAX-RS Servlet
    jersey
    com.sun.jersey.spi.container.servlet.ServletContainer

    com.sun.jersey.config.property.packages
    test



    jersey
    /*

    ReplyDelete
  27. Hi.

    Can't get this to work.

    Running weblogic 10.0
    Jersey 1.0.3

    My web.xml:


    Empty web.xml file for Web Application

    35


    html
    text/html


    txt
    text/plain


    JAX-RS Servlet
    jersey
    com.sun.jersey.spi.container.servlet.ServletContainer

    com.sun.jersey.config.property.packages
    test



    jersey
    /*

    ReplyDelete
  28. Hi,

    I have a question about EJB injection into a resource under WebLogic 10.3.

    I have sent it to https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=11900

    but no answer till now... :(

    Does this work in general? I mean DI with the @EJB annotation into a resource on WL?

    Thanks,
    Regards,
    Sandor

    ReplyDelete
  29. Any idea why generating the default application.wadl wouldn't work in WL 10?

    Using Jersey 1.2 I have deployed the helloworld sample in tomcat or glassfish, and the application.wadl shows up. But if I deploy it in Weblogic I get a 404 when I try access application.wadl. The sample works ok though, I am able to get the "hello world" message and I don't see any errors in the logs.

    ReplyDelete
  30. Hi Gerard, did u reply to Sanyi's question last year?
    I have a project running on WebLogic 10.3.3. My project use jersey library (1.5). I create a RESTful webservice using jax-rs api provided by Jersey.
    I inject an EJB using within the webservice root class:
    @EJB (beanName= "MyBeanEJB") MyBeanLocalBusiness myBeanEJB;

    When I use myBeanEJB inside a method, it is always null.

    The bean is defined as:
    @Stateless (name="MyBeanEJB")
    public class MyBean implements MyBeanLocalBusiness

    and the interface is:
    @Local
    public interface MyBeanLocalBusiness

    Can u please help me?

    Luca

    ReplyDelete