Getting java.lang.ClassNotFoundException Gatling - when running Gatling - gatling

My Gating script is erroring with the below message:
java.lang.ClassNotFoundException: testSimulation
But I didn't do anything off and just followed the documentation. I get this error only on Jenkins, not directly on my machine. So I am thinking something very obvious is wrong but I can't seem to figure it out.
My script looks like this:
package computerdatabase
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class testSimulation extends Simulation {.....
This is the snippet above.
Like I said, this works locally but not on the same versioned Gatling I use via Jenkins.
Any ideas would help. Thanks!

The error message is correct and indeed, you don't have a class whose Fully Qualified Class Name, is testSimulation.
The correct Fully Qualified Class Name of your simulation is computerdatabase.testSimulation, you're missing the package.

Related

Observing error while running Gatling project 'object gatling is not a member of package io'

I m seeing the following error while running Engine.scala
object gatling is not a member of package io import io.gatling.app.Gatling
Below is the code that is used
`import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder
object Engine extends App {
val props = new GatlingPropertiesBuilder()
.resourcesDirectory(IDEPathHelper.mavenResourcesDirectory.toString)
.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
Gatling.fromMap(props.build)
}`
I tried changing the Gatling version in mvn file, but no luck. could someone please help
It means the Gatling jars are not properly imported in your classpath.
No idea how to help you though as you're not describing exactly what you're doing and how you're getting this error: when running maven from the command line? when running from IntelliJ? or another IDE?
Note: if you're struggling with properly setting up a development environment for Scala, you should probably consider using Gatling with Java instead, where the set up is way more simple.

object johnsnowlabs is not a member of package com

I am very new to Zeppelin/spark and couldn't get an accurate description of steps to configure new dependencies like that of NLP libraries.
Found similar issue here.
I was trying to use Johnsnowlabs NLP library in Zeppelin notebook (spark version2.2.1).
Setup included :
In Zeppelin's Interpreters configurations for Spark, include the following artifact:
com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4
Then, in conf/zeppelin-env.sh, setup SPARK_SUBMIT_OPTIONS.
export SPARK_SUBMIT_OPTIONS=” — packages JohnSnowLabs:spark-nlp:2.2.2". Then restarted Zeppelin.
But the below program gives the error :
%spark
import com.johnsnowlabs.nlp.base._
import com.johnsnowlabs.nlp.annotator._
<console>:26: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.base._
^
<console>:27: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.annotator._
Can someone please share how this can be done? I referred this link .
TIA
you don't need to edit the conf/zeppelin-env.sh (anyway you're using it incorrectly, as you're specifying completely different version), you can make all changes via Zeppelin UI. Go to the Spark interpreter configuration, and put com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4 into spark.jars.packages configuration property (or add it if it doesn't exist), and into the Dependencies at the end of configuration (for some reason, it isn't automatically pulled into driver classpath).

Flow(cannot-resolve-module) error importing webp file into react

Getting a flow error returned when I import a webp image file into my react application.
I'm using the same syntax for a png image which works correctly and cannot see what the issue is?
(using create-react-app in vscode with flow v0.129.0)
import test from "./assets/test.png";
import testwebp from "./assets/test.webp";
error message returned:
Cannot resolve module `./assets/test.webp
Any chance anyone has encountered anything like this before?
Have looked through other threads but not having much luck finding a solution or clear cause.
Will keep looking in meantime.
Edit 2021-03-20
Flow has just released webp support in version 0.147.0 so you won't need a module mapper anymore for this.
https://github.com/facebook/flow/releases/tag/v0.147.0
Original Answer
It's because flow does not understand what should be returned from a webp format. You can tell it by adding module.name_mapper.extension to your flow configs
https://flow.org/en/docs/config/options/#toc-module-name-mapper-extension-string-string
You want to add something to the [options] section like the following where the assumption that importing webp files returns strings.
[options]
module.name_mapper.extension='webp' -> '<PROJECT_ROOT>/flow-mocks/empty-string.js'
Then you can create a empty-string.js file in flow-mocks
// #flow
export default '';
Now when you import webp files, flow will treat it as a string so you can get soundness if you want to pass it around or toLowerCase it, etc.

Uncaught TypeError: (0 , o.default) is not a function: What's causing it?

In my create react app project I'm running into the following error in my production build (not in my dev build):
Uncaught TypeError: (0 , o.default) is not a function
at Object.e.f.(:4444/anonymous function)...
I've been investigating this bug for a couple of hours but struggle to find out how to debug this uglified piece of js.
What makes it tough is that the error returns o.default and not SomeLibrary.default so I don't really know where to start my search really...
What does that o.default mean in this case? Any tips for figuring out what's going wrong here?
It seems to be import statement somewhere in your file is incorrect.
Example: (from an issue)
// fails
import combineReducers from "redux"
// correct
import { combineReducers } from "redux"
What makes it tough is that the error returns o.default and not SomeLibrary.default so I don't really know where to start my search really...
There's nothing but exported in some library just as o. Example default export:
export default {
o: something
}
For those who tried the solution above and still cannot solve this problem, you might be importing the library successfully and then using the library in a function that is located in the same file.
But, if you export that file and import it to another file, that is where you might be having a problem.
Simply import your already exported file as -
import {myComponent} from "/util/http"
instead of -
import myComponent from "/util/http"
Hope that helps.
If this is happening for anyone with Auth.signIn using aws-amplify, please try the below update for aws-amplify. This worked as a permanent fix and didn't break any of my current code.
sudo npx npm-check-updates -i '/#?aws-amplify/' && npm update --force
Just in case it helps someone, in my case I was using React component inside a JS file which caused this error.

bulkloader not importing ndb.model

I am still new to Python and GAE. I have an application on local server that is running just fine. I can add entity to my datastore, I can view my website, etc: everything is fine.
Now I am trying to use bulkloader to add entities to my datastore. I followed the tutorial at https://developers.google.com/appengine/docs/python/tools/uploadingdata. My loader is below:
from google.appengine.ext import ndb
from google.appengine.tools import bulkloader
import my_model
class ArticleLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Article',
[('title', str),
('author', str)
])
loaders = [ArticleLoader]
I am getting the error:
No module named my_model
Does anyone have a fix for this?
Note: I am only using one directory. So my loader is in the same location as the other file that imports the my_model module.
This can also happen if your PYTHONPATH is not properly set up. If you're on Linux, try running this before you run the Bulkloader:
export PYTHONPATH=$PYTHONPATH:.
This appends your current directory to your PYTHONPATH and should make your my_model module visible. Since my memory is terrible and I always forget to do it, I've ended up using a simple shell script that includes this at the beginning and then the bulkload command itself.
If you're on Windows, you should be able to modify your path by using sys.path.append. Haven't tested this, but you could try adding this to your script (note that this should work on Linux as well):
import sys
# ...
sys.path.append('.')
Your code should be located in a file named my_model.py. You are getting that error because there is no module named my_module. Might be worth a read of the Python module and package docs.

Resources