Hi All,
Am creating issue using Java Rest API client by following way,
IssueInputBuilder issueBuilder = new IssueInputBuilder(ProjectName, Long.parseLong(it.getId().toString())); issueBuilder.setFieldInput("customfield_10110","Some value"); final BasicIssue bissue = issueClient.createIssue(issueBuilder.build(), pm); System.out.println(" Issue "+bissue.getKey()+" Created Successfully!");
Now Attachment field in create issue screen is Required attribute. How to add attachement while creating Issue ?
Am using jira-rest-java-client-1.1-m02.jar
Please help. Thanks in advance
Community moderators have prevented the ability to post new answers.
To attach file using REST API (which is used by JRJC project) you need to create issue first. So in such configuration of create issue screen it is not possible to create new issue using REST API. You have to change configuration of create issue screen to allow creation of issue without attachment.
Hi Aleksander,
Thanks for your time. I tried to attach a file in after creating issue.
My java code
FileInputStream fileStreamPath=new FileInputStream("C:\\Users\\eswaranr\\Downloads\\Complete Program.doc"); final Issue issue = restClient.getIssueClient().getIssue("CPS-150", pm); restClient.getIssueClient().addAttachment(pm, issue.getAttachmentsUri(), fileStreamPath, "Complete Program.doc");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Will you please share pom.xml dependencies for JIRA6.0+
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Am using eclipse to run my java code.
My pom.xml
<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>13.0</version> </dependency> <dependency> <groupId>com.google.common</groupId> <artifactId>guava</artifactId> <version>14.0-rc1</version> </dependency> <dependency> <groupId>org.codehaus.jettison</groupId> <artifactId>jettison</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-logging</artifactId> <version>4.0.6</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-client</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-signature</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-apache-client</artifactId> <version>1.9.1</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> <version>1.16</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-bundle</artifactId> <version>1.16</version> </dependency> <dependency> <groupId>org.joda.time</groupId> <artifactId>joda-time</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>Jira-rest-java-client</artifactId> <version>1.1-m02</version> </dependency> <dependency> <groupId>au.com.bytecode</groupId> <artifactId>opencsv</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>org.relique</groupId> <artifactId>csvjdbc</artifactId> <version>1</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>1.8</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-apache-client</artifactId> <version>1.5</version> </dependency> </dependencies>
I got the dependency versions from this link
But still am havinig same problem.. Please help..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That doesn't look well:
<groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> <version>1.16</version>
You should use jersey-core 1.5.
To fight with incorrect dependencies problem first please compare expected dependencies with those effectively used by maven in runtime. Useful commands to see what is maven using (dependency managment and dependencies-of-dependencies sometimes changes versions of used libs):
mvn dependency:tree
mvn dependency:list
mvn help:effective-pom
Unfortunately I don't know the 'mvn tell-me-what-is-wrong' command :(.
Running mvn dependency:copy-dependencies also might be useful. This will copy all dependencies to target/dependency so you can check if jars located there are in expected version.
This is list of jersey dependencies used to build JRJC 1.x:
target/dependency % ls | grep jersey com.atlassian.jersey-library-2.5.0.pom jersey-apache-client-1.5.jar jersey-client-1.5.jar jersey-core-1.5.jar jersey-json-1.5.jar jersey-multipart-1.5.jar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Am getting following error
Jul 11, 2013 12:44:57 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: A message body writer for Java class com.sun.jersey.multipart.MultiPart, and Java type class com.sun.jersey.multipart.MultiPart, and MIME media type multipart/form-data; boundary=Boundary_1_1319874444_1373526897746 was not found
Jul 11, 2013 12:44:57 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: The registered message body writers compatible with the MIME media type are:
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you use one-jar or similar method to pack all dependencies to single jar? I had such problem while I was creating single-jar for my project.
The reason in short is that Jersey doesn't like that approach as it looks for files in META-INF (or other shared path - it was a long time ago ;)) that describes readers and writers and those files have the same name in each JAR. In effect they're overwritten while doing one-jar, which causes such errors - Jersey don't know which classes he should use for writting multipart/form data.
If that's not the case, then probably you're missing some dependencies (for example other dependecy pulls wrong version of com.sun.jersey.contribs:jersey-multipart:jar).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.