adequate
adequate
adequate
adequate
 

JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   Forums 
September 19, 2018, 03:13:38 AM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
Home Help Search Login Register
Pages: [1]   Go Down

Author Topic: (SOLVED) Not able to run JPPF code with IntelliJ and Maven  (Read 199 times)

aishwarya93

  • JPPF Padawan
  • *
  • Posts: 7
(SOLVED) Not able to run JPPF code with IntelliJ and Maven
« on: April 26, 2017, 04:01:37 PM »

Hi,

I have a simple one driver one node program that I'm able to run through the command line (Running startDriver.bat , startNode.bat and then building with ant). I am now trying to move this to IntelliJ IDE and also use Maven to keep track of dependencies. I am having a really hard time doing this.

JPPF Version

Code: [Select]
2017-04-20 09:08:12,898 [INFO ][org.jppf.utils.FileUtils.initJPPFTempDir(547)]: JPPF temp folder C:\Users\AIVAIK~1\AppData\Local\Temp\.jppf
2017-04-20 09:08:13,008 [INFO ][org.jppf.utils.VersionUtils.logVersionInformation(80)]: --------------------------------------------------------------------------------
2017-04-20 09:08:13,008 [INFO ][org.jppf.utils.VersionUtils.logVersionInformation(81)]: JPPF Version: 5.2.6, Build number: 1901, Build date: 2017-04-02 09:50 CEST
2017-04-20 09:08:13,008 [INFO ][org.jppf.utils.VersionUtils.logVersionInformation(82)]: starting node with PID=4780, UUID=3371A890-5D67-9A84-E410-E248A7959978
2017-04-20 09:08:13,008 [INFO ][org.jppf.utils.VersionUtils.logVersionInformation(83)]: --------------------------------------------------------------------------------
2017-04-20 09:08:19,164 [INFO ][org.jppf.classloader.ClassLoaderRequestHandler.run(156)]: maxBatchSize = 1
2017-04-20 09:08:19,227 [INFO ][org.jppf.execute.AbstractExecutionManager.<init>(111)]: running 4 processing threads
2017-04-20 09:08:19,227 [INFO ][org.jppf.execute.AbstractExecutionManager.createThreadManager(137)]: Using default thread manager

Environment

Windows 10 Enterprise

Code: [Select]
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

My folder directory structure in the project that works looks similar to this -

Code: [Select]
» JPPF-Tutorial
  » JPPF-x.y.z-admin-ui
  » JPPF-x.y.z-application-template
  » JPPF-x.y.z-driver
  » JPPF-x.y.z-node

As I tried to "Mavenize" this, I added the JPPF dependencies to the pom.xml. My pom.xml looks like this -

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>mpp</groupId>
    <artifactId>jppf</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.jppf/jppf-common -->
        <dependency>
            <groupId>org.jppf</groupId>
            <artifactId>jppf-common</artifactId>
            <version>5.2.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.jppf/jppf-node -->
        <dependency>
            <groupId>org.jppf</groupId>
            <artifactId>jppf-node</artifactId>
            <version>5.2.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.jppf/jppf-server -->
        <dependency>
            <groupId>org.jppf</groupId>
            <artifactId>jppf-server</artifactId>
            <version>5.2.6</version>
        </dependency>

    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

With this configuration, the IDE couldn't find JPPFClient and JPPFJob (it was underlined in red) even with the right imports. As a work around, I added the JARs manually to the project as dependencies. I thought this resolved the error as the code wasn't underlined before compiling. As soon as I try to build this with Maven, I got the following errors:

Code: [Select]
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /src/ClaimRunner.java:[4,23] cannot find symbol
  symbol:   class JPPFClient
  location: package org.jppf.client
[ERROR] /src/ClaimRunner.java:[5,23] cannot find symbol
  symbol:   class JPPFJob
  location: package org.jppf.client

Steps to run a simple JPPF job through an IDE would help a lot even if Maven can't be used to build it.

Thanks
« Last Edit: May 02, 2017, 12:07:16 AM by aishwarya93 »
Logged

aishwarya93

  • JPPF Padawan
  • *
  • Posts: 7
Re: Not able to run JPPF code with IntelliJ and Maven
« Reply #1 on: April 26, 2017, 06:35:10 PM »

Update:

I added the following to my pom.xml file -

Code: [Select]
      <dependency>
            <groupId>org.jppf</groupId>
            <artifactId>jppf-client</artifactId>
            <version>5.2.6</version>
        </dependency>

Now I am able to compile and build using Maven. It produces a JAR file. I'm still not sure how to run the code through the IDE.
Logged

aishwarya93

  • JPPF Padawan
  • *
  • Posts: 7
Re: Not able to run JPPF code with IntelliJ and Maven
« Reply #2 on: April 26, 2017, 09:00:05 PM »

Update:

I moved the three configuration files (jppf.properties, log4j.properties, logging properties) to my resources folder in Maven. I added a new run/debug configuration that picks up jppf.properties.

The program now runs through the IDE and my client runs -

Code: [Select]
.......... client process id: 2420, uuid: D917E6DA-74F0-11BC-536D-E990C0BABC90

I understand that my I am not running startDriver.bat and startNode.bat so my client isn't able to do what it needs to do. How do I get those two .bat files to run through the IDE?

Thanks,
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2240
    • JPPF Web site
Re: Not able to run JPPF code with IntelliJ and Maven
« Reply #3 on: April 27, 2017, 07:11:26 AM »

Hello,

The only maven dependency you need for a client application is on the jppf-client artifact. Other dependencies are automatically resolved via dependency transitivity. In particular, you shouldn't need to depend on jppf-node or jppf-server.

In the same way, for a node you should only need a dependency on jppf-node, and for a driver a dependency on jppf-server.

I also noiticed that you specified 1.6 for the compilation source and target. This should be changed to 1.7,as JPPF 5.2.x only supports Java 7 and later.

I'm not familiar with IntelliJ, however I'm pretty sure you can copy the JVM and program arguments that are in the starttNode.bat or startDriver.bat into the IDE's run/launch configuration, and you should be go to go.

Sincerely,
-Laurent
Logged
Pages: [1]   Go Up
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads