I am trying to crawl the javascript webpages(content present within IFrame html tag) using Crawljax. I have added slf4j, crawljax 2.1 and Guava 18.0 jar to the application.
Error Message displayed in popup:
cannot find symbol
import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuild‌​er;
symbol: class CrawljaxConfigurationBuilder
location: class CrawljaxConfiguration.
Code:
import com.crawljax.core.CrawlerContext;
import com.crawljax.core.CrawljaxRunner;
import com.crawljax.core.configuration.CrawljaxConfiguration;
import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder;
import com.crawljax.core.plugin.OnNewStatePlugin;
import com.crawljax.core.state.StateVertex;
public class CrawljaxExamples {
public static void main(String[] args) {
CrawljaxConfigurationBuilder builder
= CrawljaxConfiguration.builderFor("http://help.syncfusion.com/ug/wpf/default.htm#!documents/overview.htm");
builder.addPlugin(new OnNewStatePlugin() {
#Override
public void onNewState(CrawlerContext context, StateVertex newState) {
}
#Override
public String toString() {
return "Our example plugin";
}
});
CrawljaxRunner crawljax = new CrawljaxRunner(builder.build());
crawljax.call();
}
}
Error Message:
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: class CrawljaxConfigurationBuilder
location: class com.crawljax.core.configuration.CrawljaxConfiguration
at crawljaxexamples.CrawljaxExamples.<clinit>(CrawljaxExamples.java:12)
Exception in thread "main" Java Result: 1
Same code could be found in below Link,
https://github.com/crawljax/crawljax/blob/master/examples/src/main/java/com/crawljax/examples/PluginExample.java
Can someone please tell what are jars files required to run this program? Or is there any settings to be changed in IDE?
Thanks
It seems you are using old version of crawljax.
Download latest version crawljax-cli-3.5.1.zip
Add all jars from lib folder and crawljax-cli-3.5.1.jar from the main folder as lib path.
Tested and now it works well.
Related
I am trying to PGP Encrypt a file using Java code. I have generated pgp keys (.asc file) for the same. Below is my Java code:
package extract;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class PGPEncryption {
public static void main(String[] args) throws Exception {
String publicKeyFileName="abc-pub-sub.asc";
String keyUserid="abc";
String input_file_path="test.csv";
String output_file_path="/tmp/output";
camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
from(input_file_path).marshal()
.pgp(publicKeyFileName, keyUserid).to(output_file_path);
}
});
camelContext.start();
Thread.sleep(5000);
camelContext.stop();
}
}
Below are the Jars I added in my build Path :
bcpg-jdk15on-1.56.jar
bcprov-jdk15on-1.56.jar
camel-core-2.6.0.jar
camel-crypto-2.9.5.jar
commons-logging-1.2.jar
slf4j-api-1.7.25.jar
slf4j-nop-1.7.25.jar
But above code is giving me compile time error as below :
"The method pgp(String, String) is undefined for the type DataFormatClause<ProcessorDefinition<RouteDefinition>>"
Could someone please help me in fixing this ?
Also I tried to export my code as Runnable Jar with compile time errors. But after I execute my Jar file I am facing below error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/fusesource/commons/management/ManagementStrategy
I am not sure if I am missing any basic thing here. Could someone please help here? Thanks in Advance.
Referred Link : PGP Encryption with Apache Camel
I was getting a successful build with android in React Native until I added these:
"appcenter-analytics": "2.1.0",
"appcenter-crashes": "2.1.0",
I am on:
"react": "16.8.6",
"react-native": "0.60.4",
The error is:
Error: Command failed: ./gradlew app:installDebug
-PreactNativeDevServerPort=8081 Note: /Users/danale/Projects/NFIBEngage/node_modules/react-native-sentry/android/src/main/java/io/sentry/RNSentryModule.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for
details.
/Users/danale/Projects/NFIBEngage/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:60:
error: cannot find symbol
new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
^ symbol: class MainApplication location: class PackageList
/Users/danale/Projects/NFIBEngage/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:60:
error: cannot find symbol
new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
^ symbol: variable appCenterAnalytics_whenToEnableAnalytics
location: class string
/Users/danale/Projects/NFIBEngage/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:61:
error: cannot find symbol
new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
^ symbol: class MainApplication location: class PackageList
/Users/danale/Projects/NFIBEngage/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:61:
error: cannot find symbol
new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
^ symbol: variable appCenterCrashes_whenToSendCrashes location:
class string 4 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Apparently there is this android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java file that did not exist with the legacy version of this application:
package com.facebook.react;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.ArrayList;
import com.nfibengage.BuildConfig;
import com.nfibengage.R;
// #react-native-community/async-storage
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
// appcenter-analytics
import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
// appcenter-crashes
import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
// react-native-sentry
import io.sentry.RNSentryPackage;
// react-native-splash-screen
import org.devio.rn.splashscreen.SplashScreenReactPackage;
public class PackageList {
private Application application;
private ReactNativeHost reactNativeHost;
public PackageList(ReactNativeHost reactNativeHost) {
this.reactNativeHost = reactNativeHost;
}
public PackageList(Application application) {
this.reactNativeHost = null;
this.application = application;
}
private ReactNativeHost getReactNativeHost() {
return this.reactNativeHost;
}
private Resources getResources() {
return this.getApplication().getResources();
}
private Application getApplication() {
if (this.reactNativeHost == null) return this.application;
return this.reactNativeHost.getApplication();
}
private Context getApplicationContext() {
return this.getApplication().getApplicationContext();
}
public ArrayList<ReactPackage> getPackages() {
return new ArrayList<>(Arrays.<ReactPackage>asList(
new MainReactPackage(),
new AsyncStoragePackage(),
new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
new RNSentryPackage(),
new SplashScreenReactPackage()
));
}
}
The MainApplication.java file is inside of android/main/java/com/nfibengage/MainApplication.java:
package com.nfibengage;
import android.app.Application;
import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
#Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
#Override
protected List<ReactPackage> getPackages() {
#SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
#Override
protected String getJSMainModuleName() {
return "index";
}
};
#Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
#Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
I tried importing it into PackageList.java like so:
import com.nfibengage.MainApplication;
but I continue to get the same error. If anyone can walk me through where did this PackageList.java file come from and how do I get this working again short of just completely removing appcenter-analytics and appcenter-crashes.
Please make sure your installation order is the same as the following.
Add the App Center SDK modules
npm install appcenter appcenter-analytics appcenter-crashes --save-exact
or
yarn add appcenter appcenter-analytics appcenter-crashes --exact
Integrate the SDK automatically
react-native link appcenter
react-native link appcenter-analytics
react-native link appcenter-crashes
App Center SDK does not set up mocks automatically for App Center modules during the linking process. If you are using Jest test framework in your application and experience errors caused by the App Center SDK while running tests with Jest, add the following to the jest section of package.json file (include only modules in use):
"setupFiles": [
"<rootDir>/node_modules/appcenter/test/AppCenterMock.js",
"<rootDir>/node_modules/appcenter-analytics/test/AppCenterAnalyticsMock.js",
"<rootDir>/node_modules/appcenter-crashes/test/AppCenterCrashesMock.js",
"<rootDir>/node_modules/appcenter-push/test/AppCenterPushMock.js"
]
Edit the project's android/app/src/main/assets/appcenter-config.json and replace the YOUR_APP_SECRET placeholder value with your App Center project's application secret.
do one think only
goto your folder structure.
2.Add a file yarn-error.log
there will not be any problem your project will start well.
after some work on a spigot plugin IntelliJ itself doesn't give an error, however upon the jar build (when loaded into the server) the console prints an unirest callback error.
The project uses the spigot dependency for 1.13.2.
Code:
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.async.Callback;
import com.mashape.unirest.http.exceptions.UnirestException;
import org.bukkit.plugin.java.JavaPlugin;
public class Weather extends JavaPlugin {
#Override
public void onEnable() {
// Plugin startup logic
getServer().getScheduler().runTaskTimer(this, () -> Unirest.get("https://data.buienradar.nl/2.0/feed/json").asJsonAsync(new Callback<JsonNode>() {
#Override
public void completed(HttpResponse<JsonNode> response) {
getServer().broadcastMessage(response.getBody().toString());
getLogger().info(response.getBody().toString());
}
#Override
public void failed(UnirestException e) {
e.printStackTrace();
}
#Override
public void cancelled() {
}
}), 0, 20 * 30);
}
}
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError - Unirest means, that the class Unirest is not found at runtime. A common mistake is, that you have added the library containing the class Unirest as dependency, but the library does not get exported with your plugin. So, make sure, that when you export your plugin, the library containg the class Unirest is also included in the resulting jar file.
im trying to do simple OCR application but i get errors like this:
Code:
import org.bytedeco.javacpp.*;
import static org.bytedeco.javacpp.lept.*;
import static org.bytedeco.javacpp.tesseract.*;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.UnsupportedEncodingException;
public class Main {
public void tesseract(String filename){
BytePointer outText;
tesseract.TessBaseAPI api = new tesseract.TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api.Init("/Users/Marcel/tesseract-ocr", "ENG") != 0) {
System.err.println("Could not initialize tesseract.");
System.exit(1);
}
// Open input image with leptonica library
PIX image = pixRead(filename);
api.SetImage(image);
// Get OCR result
outText = api.GetUTF8Text();
String string = outText.getString();
assertTrue(!string.isEmpty());
System.out.println("OCR output:\n" + string);
// Destroy used object and release memory
api.End();
outText.deallocate();
pixDestroy(image);
}
public static void main(String[] args) {
Main main = new Main();
String fileName = "src/main/resources/test.png";
main.tesseract(fileName);
}
}
I have tried some solutions from google, but it didnt solve this. I using Inteliji (with maven) on Mac OSX. Before i had problem with TESTDATA_PREFIX, but i changed api.init first parameter and now i get this:
dyld: lazy symbol binding failed: Symbol not found: __ZN9tesseract11TessBaseAPI8SetImageEPK3Pix
Referenced from: /private/var/folders/lq/3mb8s_jj1ql0klqzznm1j1tm0000gn/T/javacpp33697284992581/libjnitesseract.dylib
Expected in: /usr/local/lib/libtesseract.3.dylib
dyld: Symbol not found: __ZN9tesseract11TessBaseAPI8SetImageEPK3Pix
Referenced from: /private/var/folders/lq/3mb8s_jj1ql0klqzznm1j1tm0000gn/T/javacpp33697284992581/libjnitesseract.dylib
Expected in: /usr/local/lib/libtesseract.3.dylib
This is because of 2 conflicting libtesseract.3.dylib.
If you have installed tesseract on mac using brew then it is referring to the libtesseract.3.dylib inside tesseract folder /usr/local/Cellar/tesseract/3.04.01_1/lib/
instead of /usr/local/lib/libtesseract.3.dylib
I am trying to use a custom formatter to turn a boolean into "Yes" or "No" and have run into a roadblock.
My IDE (Eclipse) does not indicate any errors but when I try to compile I receive
[ERROR] Annotation error: cannot resolve foobar.client.formatter.YesNoFormatter - exception: ClassNotFoundException
followed by a few other exceptions that appear to stem from this exception. I understand what a ClassNotFoundException indicates however I cannot figure out why I would be getting it since, as my code shows, the YesNoFormatter class is located in foobar.client.formatter and I can access it through
GWT.log("True: " + YesNoFactory.getFormat().format(Boolean.TRUE);
I am using GXT 3.1.0 and GWT 2.6.1.
Could anybody have an idea of why I am getting this exception? The example given at http://docs.sencha.com/gxt-guides/3/utility/xtemplates/XTemplates.html doesn't mention anything (as far as I can see) about these classes needing to be in specific locations so I am at a loss.
EntryPoint:
package foobar.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.sencha.gxt.core.client.XTemplates.FormatterFactories;
import com.sencha.gxt.core.client.XTemplates.FormatterFactory;
public class TestClass implements EntryPoint {
#FormatterFactories(#FormatterFactory(factory=YesNoFactory.class, name="yesNo"))
public interface Renderer extends XTemplates {
#XTemplate(source="yesNo.html")
SafeHtml render(Boolean b);
}
#Override
public void onModuledLoad() {
GWT.log("True: " + YesNoFactory.getFormat().format(Boolean.TRUE);
Renderer r = GWT.create(Renderer.class);
Window.alert(r.render(true).asString());
}
}
YesNo:
package foobar.client.formatter;
import com.sencha.gxt.core.client.XTemplates.Formatter;
public class YesNo implements Formatter<Boolean> {
#Override
public String format(Boolean data) {
if (data == null) {
return null;
}
return (data) ? "Yes" : "No";
}
}
YesNoFactory:
package foobar.client.formatter;
public class YesNoFactory {
public static YesNo getFormat() {
return new YesNo();
}
}
in foobar
<?xml version="1.0 encoding="UTF-8"?>
<module>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.sencha.gxt.GXT'/>
<entry-point class='foobar.client.TestClass'/>
<source path='client'/>
</module>
foobar/client/yesNo.html:
{b:yesNo()}
My formatter classes (YesNo and YesNoFactory) apparently have to be in a location that gets compiled prior to compiling the client-side code. After I moved these classes to my 'shared' package - the package that houses code used by the client and server - everything worked.
This was not obvious in the XTemplates portion of the guide at http://docs.sencha.com/gxt-guides/3/utility/xtemplates/XTemplates.html which does not seem to specify where the files used for custom formatters need to be located. Maybe that should have been obvious but not to me.