0

I am using WSO2 Mediator Project to create JSON payload by using WSO2 Integration Studio 8.0.0.

Integration Studio ERROR:

JsonUtil cannot be resolved

ERROR

pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.test.in</groupId>
    <artifactId>Jubilant_EmailTicketing</artifactId>
    <version>1.0.0</version>
    <relativePath>..\pom.xml</relativePath>
  </parent>
  <groupId>com.jubilant.in.Jubilant_EmailTicketing-Mediator</groupId>
  <artifactId>Jubilant_EmailTicketing-Mediator</artifactId>
  <version>1.0.0</version>
  <packaging>bundle</packaging>
  <name>Jubilant_EmailTicketing-Mediator</name>
  <description>Jubilant_EmailTicketing-Mediator</description>
  <properties>
    <CApp.type>lib/synapse/mediator</CApp.type>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.apache.axis2.wso2</groupId>
      <artifactId>axis2</artifactId>
      <version>1.6.1.wso2v20</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
    </dependency>
   <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20141113</version>
    </dependency>
    <!-- Requested Dependency -->
    <dependency>
        <groupId>org.apache.synapse</groupId>
        <artifactId>synapse-commons</artifactId>
        <version>3.0.1</version>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.4</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>Jubilant_EmailTicketing-Mediator</Bundle-SymbolicName>
            <Bundle-Name>Jubilant_EmailTicketing-Mediator</Bundle-Name>
            <Export-Package>com.jubilant.in</Export-Package>
            <DynamicImport-Package>*</DynamicImport-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <buildcommands>
            <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
          </buildcommands>
          <projectnatures>
            <projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
            <projectnature>org.eclipse.jdt.core.javanature</projectnature>
          </projectnatures>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

added dependency file by following this

Still can't able to resolve this JsonUtil ERROR.

import Statement:

import org.apache.synapse.commons.json.JsonUtil;

Can anyone please help me to resolve this ERROR? or kindly suggest any Jar file for the same?

Community
  • 1
  • 1
Justin
  • 855
  • 2
  • 11
  • 30
  • If you are using synapse-core in 3.0.1 version, then its better to use : ` org.apache.synapse synapse-commons 3.0.1 ', than 6year old. And remove duplicates in your pom file. Its messy. – tmoasz Aug 24 '21 at 14:48
  • Hi @tmoasz Thanks for your suggestion, I have updated pom.xml file by adding requested dependency file. Still it doesn't resolve error. Kindly check pom.xml file updated in question and let me know if anything needs to be changed. PS: Project clean , Eclipse restart done. – Justin Aug 24 '21 at 15:16
  • The Integration Studio sometimes is "lazy", so maybe after pom edit, it need to update mvn project (Alt+F5) and/or reload (Close&Open) in Project Explorer. For me it also doesn't work, when i use VPN. But all in all i was able to setup CustomMediator project, and sucess build with mvn clean instal. – tmoasz Aug 24 '21 at 15:23
  • Hi @tmoasz, The above given dependency file doesn't resolve my issue even after maven update. i have findout some more dependency in the following link which resolve my issue. anyway Thanks a lot again. link: https://mvnrepository.com/artifact/org.apache.synapse/synapse-commons/2.1.7-wso2v228 – Justin Aug 25 '21 at 08:54

1 Answers1

0

I resolved above JsonUtil ERROR by adding below dependency in pom.xml

Note: after iupdating pom.xml, i did mvn update by clicking alt+f5.

dependency:

<!-- https://mvnrepository.com/artifact/org.apache.synapse/synapse-commons -->
<dependency>
    <groupId>org.apache.synapse</groupId>
    <artifactId>synapse-commons</artifactId>
    <version>2.1.7-wso2v228</version>
</dependency>

Reference Link: click here

Justin
  • 855
  • 2
  • 11
  • 30