error in running examples from the power package

1,383 views
Skip to first unread message

anitha Y

unread,
May 22, 2013, 12:28:49 AM5/22/13
to clou...@googlegroups.com

sir,
i got the errors as follows after running these command,
C:\Program Files\cloudsim-3.0.3>java -classpath jars\cloudsim-3.0.3.jar;jars\fla
nagan.jar;examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc
Initialising...
java.lang.NullPointerException
        at org.cloudbus.cloudsim.examples.power.planetlab.PlanetLabHelper.create
CloudletListPlanetLab(PlanetLabHelper.java:49)
        at org.cloudbus.cloudsim.examples.power.planetlab.PlanetLabRunner.init(P
lanetLabRunner.java:71)
        at org.cloudbus.cloudsim.examples.power.RunnerAbstract.<init>(RunnerAbst
ract.java:95)
        at org.cloudbus.cloudsim.examples.power.planetlab.PlanetLabRunner.<init>
(PlanetLabRunner.java:55)
        at org.cloudbus.cloudsim.examples.power.planetlab.LrMc.main(LrMc.java:42
)
The simulation has been terminated due to an unexpected error


i already downloade flangan.jar file in/cloudsim/jars directory
iam using windows7, jdk1.6
pls help me
--
regards,
anitha

gagan bopanna

unread,
May 22, 2013, 3:26:28 AM5/22/13
to clou...@googlegroups.com
The error is occurring because your program is not able to locate the workload  folder from which the program picks up the workload files in order to create cloudlets for these files...figure it out...If you can't then try this:
Find the inputFolder variable in the example that u r trying to run...Instead of the relative path that they have used to get the workload folder, use a full pathname instead
Ex: "C:\home\workspace\cloudsim-3.0.3\examples\workload\planetlab".


In your error message you see

at org.cloudbus.cloudsim.
examples.power.planetlab.PlanetLabHelper.create
CloudletListPlanetLab(PlanetLabHelper.java:49)

here file.length is null and if you define the right path to the workload folder it should be equal to the number of files in that folder. Once you define the path you can use a print statement on this value to see if its working.

All these problems can be avoided if you organize the project correctly.




--
 
---
You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudsim+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

anitha Y

unread,
May 22, 2013, 5:59:23 AM5/22/13
to clou...@googlegroups.com
i changed the path name as shown below 
===========

package org.cloudbus.cloudsim.examples.power.planetlab;

 

import java.io.IOException;

 

/**

 * A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM

 * allocation policy and Maximum Correlation (MC) VM selection policy.

 *

 * This example uses a real PlanetLab workload: 20110303.

 *

 * The remaining configuration parameters are in the Constants and PlanetLabConstants classes.

 *

 * If you are using any algorithms, policies or workload included in the power package please cite

 * the following paper:

 *

 * Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive

 * Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in

 * Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,

 * Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012

 *

 * @author Anton Beloglazov

 * @since Jan 5, 2012

 */

public class LrMc {

 

   /**

    * The main method.

    *

    * @param args the arguments

    * @throws IOException Signals that an I/O exception has occurred.

    */

   public static void main(String[] args) throws IOException {

      boolean enableOutput = true;

      boolean outputToFile = false;

     

 

String inputFolder = LrMc.class.getClassLoader().getResource("C:/Program Files/cloudsim-3.0.3/examples/workload/planetlab").getPath();

instead of

String inputFolder = LrMc.class.getClassLoader().getResource("workload/planetlab").getPath();

      String outputFolder = "output";    

      String workload = "20110303"; //PlanetLab workload

      String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy

      String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy

      String parameter = "1.2"; // the safety parameter of the LR policy

 

      new PlanetLabRunner(

                  enableOutput,

                  outputToFile,

                  inputFolder,

                  outputFolder,

                  workload,

                  vmAllocationPolicy,

                  vmSelectionPolicy,

                  parameter);

   }

 

}

=============

but again i got the error 


C:\Program Files\cloudsim-3.0.3> java -classpath jars\cloudsim-3.0.3.jar;jars\fl

anagan.jar;examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc

Exception in thread "main" 

java.lang.NullPointerException

        at org.cloudbus.cloudsim.examples.power.planetlab.LrMc.main(LrMc.java:37

)


--
regards,
anitha

gagan bopanna

unread,
May 22, 2013, 6:54:41 AM5/22/13
to clou...@googlegroups.com
just use inputFolder= "C:/Program Files/cloudsim-3.0.3/examples/workload/planetlab"

Binal Parekh

unread,
Feb 9, 2016, 8:47:57 AM2/9/16
to cloudsim
i am getting nullpointerException error at cloudsim.startsimulation

i declared all enetities and packages before cloudsim.startsimulation but still this error i dont kknoow why ..plz help me 

Jitendra Verma

unread,
Aug 3, 2016, 7:22:36 AM8/3/16
to cloudsim, anithas...@gmail.com

Replace "String inputFolder = GMMT.class.getClassLoader().getResource("workload/planetlab").getPath();" with

String inputFolder = System.getProperty("user.dir") + "/examples/workload/planetlab";

On using this line of code, the simulation programme will remain valid every operating system.

punit gupta(10303441)

unread,
Jul 15, 2017, 2:24:59 AM7/15/17
to cloudsim, anithas...@gmail.com
thanks it worked

Masoud Nasirinezhad

unread,
Jul 30, 2021, 2:24:08 AM7/30/21
to cloudsim
Thank you for your help
Reply all
Reply to author
Forward
0 new messages