Note that there are some explanatory texts on larger screens.

plurals
  1. POJira Gadget: Simple call to REST resource doesn't work
    primarykey
    data
    text
    <p>Im trying to write a gadget inside a jira plugin and I've encountered some problems even with a very simple one. Currently I'm trying to get a response from a simple java class i wrote. Following code is located in my gadget.xml: <pre><code> Hello Gadget&lt;br /&gt; #requireResource("com.atlassian.gadgets.publisher:ajs-gadgets") #requireResource("com.tngtech.gadgets.jira-complain-gadget-plugin:web-resources") #includeResources() #oauth &lt;script type="text/javascript"&gt;(function () { var gadget = AJS.Gadget({ baseUrl: "__ATLASSIAN_BASE_URL__", view: { onResizeAdjustHeight: true, enableReload: true, template: function(args) { var gadget = this; window.alert("1"); gadget.getView().html(args.hello); window.alert("2"); }, args: [{ key: "hello", ajaxOptions: function () { return { url: "/rest/jira-rest/1.0/ComplainChart/HelloWorld" }; } }] } }); })(); &lt;/script&gt; ]]&gt;&lt;/Content&gt; </code></pre> <p>The Java class i adress looks like this:</p> <pre><code>@Path("/ComplainChart") @AnonymousAllowed @Produces(MediaType.TEXT_HTML) public class ComplainChart { public ComplainChart() { } @GET @Path("/HelloWorld") @Produces(MediaType.TEXT_HTML) public Response getVersionsForProject() { return Response.ok("Hello Java&lt;br/&gt;").build(); } } </code></pre> <p>The URL is probably correct, the firebug output for the get Request looks like this:</p> <pre><code>throw 1; &lt; don't be evil' &gt;{"http://localhost:1990/jira/rest/jira-rest/1.0/complainChart/HelloWorld?cacheBuster=1308293636385":{"headers":{"set-cookie":["JSESSIONID=5652167D4DADE39719C4FED0C7174A03;Path=/","atlassian.xsrf.token=BV8N-OK2J-IQUQ-YNNK|b52c0f4b28944d7d11561aed079093f767448aca|lin; Path=/jira"]},"body":"Hello Java&lt;br/&gt;","rc":200}} </code></pre> <p>Even without the gadget.getView part, the alerts aren't executed (they are without the args part) and I get a huge Stack Trace in my atlas-run terminal</p> <pre><code>[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. [INFO] [talledLocalContainer] at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:152) [INFO] [talledLocalContainer] at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:115) [INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilter(DefaultServletModuleManager.java:358) [INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilters(DefaultServletModuleManager.java:212) ............. </code></pre> <p>Can anyone help me please?</p> <p>Alex</p> <p>Edit: Fyi here my pom file, I'm not sure, it's completely right this way:</p> <pre><code>&lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.gadgets&lt;/groupId&gt; &lt;artifactId&gt;atlassian-gadgets-api&lt;/artifactId&gt; &lt;version&gt;3.1.7&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.jira&lt;/groupId&gt; &lt;artifactId&gt;atlassian-jira&lt;/artifactId&gt; &lt;version&gt;${jira.version}&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.6&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.jira&lt;/groupId&gt; &lt;artifactId&gt;jira-func-tests&lt;/artifactId&gt; &lt;version&gt;${jira.version}&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt; &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt; &lt;version&gt;1.1.1&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.jira&lt;/groupId&gt; &lt;artifactId&gt;jira-rest-plugin&lt;/artifactId&gt; &lt;version&gt;${jira.version}&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt; &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt; &lt;version&gt;2.1&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.plugins.rest&lt;/groupId&gt; &lt;artifactId&gt;atlassian-rest-common&lt;/artifactId&gt; &lt;version&gt;2.5.0&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;servlet-api&lt;/artifactId&gt; &lt;version&gt;2.5&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.atlassian.sal&lt;/groupId&gt; &lt;artifactId&gt;sal-api&lt;/artifactId&gt; &lt;version&gt;2.1.0.beta1&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;com.atlassian.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jira-plugin&lt;/artifactId&gt; &lt;version&gt;3.5-SNAPSHOT&lt;/version&gt; &lt;extensions&gt;true&lt;/extensions&gt; &lt;configuration&gt; &lt;productVersion&gt;${jira.version}&lt;/productVersion&gt; &lt;productDataVersion&gt;${jira.data.version}&lt;/productDataVersion&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;properties&gt; &lt;jira.version&gt;4.3.4&lt;/jira.version&gt; &lt;jira.data.version&gt;4.3.4&lt;/jira.data.version&gt; &lt;/properties&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload