Weka API: Installing package using package manager - weka

I am trying to use libsvm via Weka API. I have added weka-dev-3.7.6.jar and libsvm.jar to my eclipse build path. The following is the code to load the libsvm library
public static void main(String[] args) {
try {
WekaPackageManager.loadPackages(true);
AbstractClassifier classifier = ( AbstractClassifier ) Class.forName(
"weka.classifiers.functions.LibSVM" ).newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
System.err.println("error 1");
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
System.err.println("error 2");
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.err.println("error 3");
e.printStackTrace();
}
}
I got the following error
Refreshing GOE props...
Exception in thread "main" java.lang.UnsupportedClassVersionError: java_cup/runtime/SymbolFactory : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
I added java-cup-11b-runtime.jar on the build path. However, the error persists.

You are trying to run your application with a JVM that does not support Java 8.
Install a Java 8 compatible JRE (or JDK if you need it for development) and use the included JVM to run your application.
Here are the major.minor version numbers mapped to Java versions:
J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45
Read here for a Wikipedia reference.

Related

cannot access webservice made in java 14 using application made in java 7

My application is developed in java 7 and i have to access a "https" web service which is developed in java 14.I am getting "Received fatal alert: handshake_failure"
this is stacktrace
*** ClientHello, TLSv1.2
RandomCookie: GMT: 1592616408 bytes = { 12, 135, 232, 24, 158, 109, 182, 182, 90, 77, 217, 233, 239, 161, 116, 121, 128, 150, 234, 201, 224, 14, 34, 171, 199, 213, 212, 98 }
Session ID: {}
Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_RC4_128_MD5, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods: { 0 }
Extension elliptic_curves, curve names: {secp256r1, sect163k1, sect163r2, secp192r1, secp224r1, sect233k1, sect233r1, sect283k1, sect283r1, secp384r1, sect409k1, sect409r1, secp521r1, sect571k1, sect571r1, secp160k1, secp160r1, secp160r2, sect163r1, secp192k1, sect193r1, sect193r2, secp224k1, sect239k1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA224withECDSA, SHA224withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA, MD5withRSA
Extension server_name, server_name: [host_name: collabdds.gov.in]
***
http-localhost%2F127.0.0.1-8080-7, WRITE: TLSv1.2 Handshake, length = 246
http-localhost%2F127.0.0.1-8080-7, READ: TLSv1.2 Alert, length = 2
http-localhost%2F127.0.0.1-8080-7, RECV TLSv1 ALERT: fatal, handshake_failure
http-localhost%2F127.0.0.1-8080-7, called closeSocket()
http-localhost%2F127.0.0.1-8080-7, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
http-localhost%2F127.0.0.1-8080-7, called close()
http-localhost%2F127.0.0.1-8080-7, called closeInternal(true)
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
My code is
private static SSLSocketFactory getSSLSocketFactory() {
try
{
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
#Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { }
#Override
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { }
#Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
};
final SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, new SecureRandom());
SSLContext.setDefault(sslContext);
return sslContext.getSocketFactory();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
somewhere in another function i have written following
((HttpsURLConnection)conn).setSSLSocketFactory(getSSLSocketFactory());
this is my server's VM arguments
In my jre7\lib\security
i have update local_policy.jar and US_export_policy.jar
what am i missing . Do i need to add cipher suits or it can be browser problem ( i am using firefox 84.0) or something else. I cannot upgrade to java8.
According to SSLLabs the server collabdds.gov.in supports only four TLS1.2 ciphers (TLS1.3 is also supported by the server but not supported by Java 7 at all):
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
Your Java version does not support any of those ciphers, hence the connection can not be established and the TLS handshake fails.
Java 7 is a dead horse when it comes to online and web services. If you want to access this server I strongly recommend to you to switch to Java 8. Or you have to use a local proxy that performs the "HTTPS translation" from recent TLS1.2 ciphers to your old and insecure Java version.
In my opinion you should take this to really consider upgrading to Java 8. Earlier or later you have to do this anyway.
Note that the used web browser is totally irrelevant for problems where your application acts as a client for a backend-service. Only if the web browser would directly connects to the back-end server this would matter.

PowerMock fails with JerseyTest

We're writing unit tests for a Jersey Java REST service using PowerMock. We have to use PowerMock because we use numerous static methods in a legacy system. We're using PowerMock with EasyMock. Whenever we try to inherit from JerseyTest, the whole framework fails.
It's a gradle based project, and the pertinent build.gradle lines are below.
testCompile 'junit:junit:4.12'
testCompile group: 'org.easymock', name: 'easymock', version: '3.5.1'
testCompile group: 'org.easymock', name: 'easymockclassextension', version: '3.2'
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.7.3'
testCompile group: 'org.powermock', name: 'powermock-api-easymock', version: '1.7.3'
We have a few EasyMock unit tests up and running, so we know our imports are working correctly. The problem is that since we're testing a Jersey web service, our unit tests inherit from JerseyTest. Writing a PowerMock unit test without inheriting from JerseyTest works fine. But when we try to inherit from JerseyTest, it all falls apart. Google failed us (apparently no one else who has written a Jersey web service has tried using PowerMock).
What we do is fairly straight-forward. This works:
#RunWith(PowerMockRunner.class)
public class PowerMockTest {
private final static String TARGET = "ourwebservice/";
#Test
public void testConfigurationGet() {
// do stuff, but no Jersey web service calls
}
}
Changing the class declaraction to inherit from JerseyTest, however:
public class PowerMockTest extends JerseyTest {
And we get a complete failure. We're using Eclipse as our IDE, and this is the error that displays in the JUnit window:
initializationError (0.000 s)
The Failure Trace window gives more details:
java.lang.VerifyError: Inconsistent stackmap frames at branch target 38
Exception Details:
Location:
com/ourcompany/ourproduct/rest/PowerMockTest.<init>()V #38: aload_1
Reason:
Type uninitializedThis (current frame, locals[1]) is not assignable to 'com/ourcompany/ourproduct/rest/PowerMockTest' (stack map, locals[1])
Current Frame:
bci: #24
flags: { flagThisUninit }
locals: { uninitializedThis, uninitializedThis, top, 'java/lang/Object' }
stack: { 'java/lang/Object', 'java/lang/Object' }
Stackmap Frame:
bci: #38
flags: { flagThisUninit }
locals: { uninitializedThis, 'com/ourcompany/ourproduct/rest/PowerMockTest' }
stack: { }
Bytecode:
0x0000000: 2a4c 1211 b800 1703 bd00 1912 1ab8 001e
0x0000010: b800 244e 2db2 0028 a500 0e2a 01c0 002a
0x0000020: b700 2ea7 0009 2bb7 0030 0157 a700 0301
0x0000030: 3a05 2ab8 0036 b1
Stackmap Table:
append_frame(#38,Object[#14])
chop_frame(#44,1)
same_frame(#47)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:109)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:85)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl.<init>(PowerMockJUnit47RunnerDelegateImpl.java:42)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl.<init>(PowerMockJUnit49RunnerDelegateImpl.java:25)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:172)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:48)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:108)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:71)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:36)
at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:87)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:73)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
We can't even step into the method to debug it; it fails before that (note, the test doesn't even actually do anything yet; we're just trying to get things set up first).
Anyone have any idea what's going on? Do we have some sort of configuration error? Do we have to switch to Mockito?

ModuleVersionNotFoundException: Cannot resolve external dependency org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb

I have following gradle.build file. I would like to generate jar from wsdl:
group 'com.parma.rudenkov'
version '1.0-SNAPSHOT'
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "no.nils:wsdl2java:0.10"
}
}
apply plugin: "no.nils.wsdl2java"
apply plugin: "java"
wsdl2java{
wsdlsToGenerate = [
['-p','com.acme.mypackage', '-autoNameResolution',"$projectDir/src/main/resources/myWsdlFiles/BuyerServiceBean.wsdl"]
]
generatedWsdlDir = file("$projectDir/generatedsources")
wsdlDir = file("$projectDir/src/main/resources/wsdl")
locale = Locale.FRANCE
}
When I run gradle wsdl2java --stacktrace I get following exception:
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':wsdl2java'.
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.rethrowFailure(DefaultLenientConfiguration.java:63)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.rethrowFailure(DefaultResolvedConfiguration.java:36)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$FilesAggregatingResolvedConfiguration.rethrowFailure(SelfResolvingDependencyResolver.java:115)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.rethrowFailure(ErrorHandlingArtifactDependencyResolver.java:191)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:674)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:284)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.getProperty(BeanDynamicObject.java:163)
at org.gradle.api.internal.BeanDynamicObject.getProperty(BeanDynamicObject.java:106)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:81)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getProperty(Unknown Source)
at no.nils.wsdl2java.Wsdl2JavaTask.setupClassLoader(Wsdl2JavaTask.groovy:94)
at no.nils.wsdl2java.Wsdl2JavaTask.wsdl2java(Wsdl2JavaTask.groovy:64)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 58 more
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Cannot resolve external dependency org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:+ because no repositories are defined.
Required by:
com.param.rudenkov:pan:1.0-SNAPSHOT
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NoRepositoriesResolver.resolve(NoRepositoriesResolver.java:48)
at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:58)
at org.gradle.api.internal.artifacts.ivyservice.dependencysubstitution.DependencySubstitutionResolver.resolve(DependencySubstitutionResolver.java:50)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:861)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:230)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:119)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:94)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:84)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:142)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:96)
at org.gradle.internal.Transformers$4.transform(Transformers.java:137)
at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:96)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:41)
at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:56)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:46)
at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:45)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:363)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:338)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:331)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:672)
... 74 more
BUILD FAILED
You have to specify repository where from download jar libraries.
repositories{
mavenCentral()
}

How to remove special character in the string

This could be a possbile duplicate. Still im not able to find a solution for it.Yes i tried with regexp but is there any other way to solve it?
String s="This is a â¦sample ⦠Java class to show the issueâ¨\nHow to solve it?";
try {
System.out.print("ANSWER="+URLDecoder.decode(s, "UTF-8")); ;
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
How can i fix this issue? Can some one help
Thanks in advance
The console output
Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (javaClasses.cpp:136), pid=17620, tid=14220
# fatal error: Invalid layout of preloaded class
#
# JRE version: (7.0_79-b15) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.79-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
Try this
String yourString= "This is a â¦sample ⦠Java class to show the issueâ¨\nHow to solve it?";
Pattern myPattern = Pattern.compile("[^a-zA-Z0-9]");
Matcher myMatcher = myPattern.matcher(yourString);
while(myMatcher.find())
{
String temp= myMatcher.group();
yourString=yourString.replaceAll("\\"+temp, " ");
}
System.out.println(yourString);

Why "no class found error" while using external jar (but I exported external jar too!)

In pig, I'm using my udf which is using external jar file routines, and in eclipse I did export that jar file too. But while running pig -x local script1.pig, it gives me error for external jar file routines.
Please help!
Thanks.
EDIT 1:
As asked in comments for my code:
script1.pig:
REGISTER ./csv2arff.jar;
csvraw = LOAD 'sample' USING PigStorage('\n') as (c);
arffraws = FOREACH csvraw GENERATE pighw2java.CSV2ARFF(c);
pighw2java.CSV2ARFF:
public String exec(Tuple input) throws IOException {
if (input == null || input.size() == 0)
return null;
try{
System.out.println(">>> " + input.get(0).toString());
// 1.1) csv to instances
ByteArrayInputStream inputStream = new ByteArrayInputStream(input.get(0).toString().getBytes("UTF-8"));
CSVLoader loader = new CSVLoader(); **HERE IS ERROR**
.....
}
}
Error I got:
java.lang.NoClassDefFoundError: weka/core/converters/CSVLoader
at pighw2java.CSV2ARFF.exec(CSV2ARFF.java:24)
at pighw2java.CSV2ARFF.exec(CSV2ARFF.java:1)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:216)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:305)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:322)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:332)
at org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:284)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.runPipeline(PigGenericMapBase.java:271)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:266)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212)
Caused by: java.lang.ClassNotFoundException: weka.core.converters.CSVLoader
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 14 more
You need to register all of the 3rd party dependencies that are used in your custom UDF. Here:
register '/path/to/weka.jar'