NoSuchMethod exception when using scala Regex class... confused - eclipse

I have a simple Scala project that runs without any problems inside Eclipse, however, when packaged into a .jar I receive this exception when running it:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: scala.util.matching.Regex.replaceAllIn(Ljava/lang/CharSequence;Lscala/Function1;)Ljava/lang/String;
What is going on here?...
The code line in question, and the full stack are below.
This is the offending line:
"alt=\"[^>]+\">".r.replaceAllIn(inputStr, {_.replace(">", "/>")})
Full stack:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: scala.util.matching.Regex.replaceAllIn(Ljava/lang/CharSequence;Lscala/Function1;)Ljava/lang/String;
at com.inosat.fuel.FuelStationDgge.fixhtml(FuelStationDgge.scala:40)
at com.inosat.fuel.FuelStationDgge.setDetails(FuelStationDgge.scala:82)
at com.inosat.fuel.DggeParser$$anon$1.propertyChange(DggeParser.scala:49)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at org.jdesktop.beans.AbstractBean.firePropertyChange(AbstractBean.java:302)
at org.jdesktop.http.async.AsyncHttpRequest.setReadyState(AsyncHttpRequest.java:705)
at org.jdesktop.http.async.AsyncHttpRequest.access$600(AsyncHttpRequest.java:79)
at org.jdesktop.http.async.AsyncHttpRequest$AsyncWorker.done(AsyncHttpRequest.java:831)
at javax.swing.SwingWorker$5.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at sun.swing.AccumulativeRunnable.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Found out what's wrong, Eclipse is using a scala-library.jar from:
C:\eclipse\configuration\org.eclipse.osgi\bundles
and for some reason the jar I copied from Scala's installation folder is not the same.
Fixed by using the same scala-library.jar that Eclipse is using.

Related

ClassNotFound on CloudFoundry push of alp server directory, but not on push of EAR :-?

I am currently trying to deploy a Java Application into IBM Liberty for Cloud Foundry. The Application is a Spring-Boot application. The deployment works perfect when pushing the EAR itself. But I need to amend the server.xml of the Liberty server. Thus I now push a defaultServer directory containing the server.xml and my EAR.
For now I have copied the server.xml from the profile in the cloud when it is successfully deployed via push EAR. So I expect the server.xml to be working. But when I now deploy the defaultServer I suddenly get a ClassNotFoundException on server start.
What is going wrong? Why does it suddenly not find its dependencies event though the EAR is pretty much the same.
------Start of DE processing------ = [4/15/19 21:12:17:313 UTC]
Exception = java.util.ServiceConfigurationError
Source = com.ibm.ws.webcontainer.osgi.DynamicVirtualHost
probeid = startWebApp
Stack Dump = java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer could not be instantiated
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2453)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:995)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6594)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:467)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:462)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1140)
at com.ibm.ws.webcontainer.osgi.WebContainer.access$000(WebContainer.java:110)
at com.ibm.ws.webcontainer.osgi.WebContainer$3.run(WebContainer.java:952)
at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:239)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org.springframework.context.ApplicationContextInitializer
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:357)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:281)
at java.lang.ClassLoader.loadClassHelper(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:522)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2453)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:482)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer.<clinit>(AutoReconfigurationServletContainerInitializer
.java:33)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Unknown Source)
... 17 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextInitializer
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:544)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:286)
at java.lang.ClassLoader.loadClassHelper(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:522)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:482)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 29 more
I would expect that the application starts the same way as with only pushing the EAR so that I can go on manipulating the server.xml as needed.
Thanks,
Alex

Unable to find NodeJSInstalls for Parsing TypeScript file using Eclipse plugin

i'm facing below issue while parsing TypeScript files in the Eclipse plugin project. Following are log details:
INFO [main] (GeneratorMain.java:178) - Start generate model STST0101_swap_js.xbl
java.lang.NullPointerException
at ts.eclipse.ide.internal.core.Trace.trace(Trace.java:89)
at ts.eclipse.ide.internal.core.Trace.trace(Trace.java:61)
at ts.eclipse.ide.internal.core.nodejs.NodejsInstallManager.loadNodejsInstalls(NodejsInstallManager.java:109)
at ts.eclipse.ide.internal.core.nodejs.NodejsInstallManager.getNodejsInstalls(NodejsInstallManager.java:68)
at com.sample.ts.nodejs.NodeJSProcess.getNodeJsPath(NodeJSProcess.java:125)
at com.sample.ts.nodejs.NodeJSProcess.startServer(NodeJSProcess.java:198)
at com.sample.ts.nodejs.NodeJSProcess.ensureRunning(NodeJSProcess.java:85)
at com.sample.ts.tsparser.ScriptParserClient.executeRequest(ScriptParserClient.java:43)
at com.sample.ts.tsparser.ScriptParserClient.parseString(ScriptParserClient.java:100)
at com.sample.ts.tsparser.ScriptParser.parse(ScriptParser.java:73)
at com.sample.ts.ast.AST.parseString(AST.java:163)
at com.sample.nmc.ts.generator.GeneratorBase.findClass(GeneratorBase.java:302)
at com.sample.nmc.ts.generator.GeneratorBase.ensureClass(GeneratorBase.java:115)
at com.sample.nmc.ts.generator.EventActionGenerator.doGenerate(EventActionGenerator.java:37)
at com.sample.nmc.ts.generator.GeneratorBase.generate(GeneratorBase.java:58)
at com.sample.nmc.ts.GeneratorMain.generateXbl(GeneratorMain.java:198)
at com.sample.nmc.ts.GeneratorMain.generateFunctionUnit(GeneratorMain.java:168)
at com.sample.nmc.ts.GeneratorMain.execute(GeneratorMain.java:66)
at com.sample.nmc.ts.GeneratorMain.main(GeneratorMain.java:43)
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.sample.ts.tsparser.ScriptParserClient.executeRequest(ScriptParserClient.java:52)
at com.sample.ts.tsparser.ScriptParserClient.parseString(ScriptParserClient.java:100)
at com.sample.ts.tsparser.ScriptParser.parse(ScriptParser.java:73)
at com.sample.ts.ast.AST.parseString(AST.java:163)
at com.sample.nmc.ts.generator.GeneratorBase.findClass(GeneratorBase.java:302)
at com.sample.nmc.ts.generator.GeneratorBase.ensureClass(GeneratorBase.java:115)
at com.sample.nmc.ts.generator.EventActionGenerator.doGenerate(EventActionGenerator.java:37)
at com.sample.nmc.ts.generator.GeneratorBase.generate(GeneratorBase.java:58)
at com.sample.nmc.ts.GeneratorMain.generateXbl(GeneratorMain.java:198)
at com.sample.nmc.ts.GeneratorMain.generateFunctionUnit(GeneratorMain.java:168)
at com.sample.nmc.ts.GeneratorMain.execute(GeneratorMain.java:66)
at com.sample.nmc.ts.GeneratorMain.main(GeneratorMain.java:43)
The plugin project runs perfectly fine if executed as Eclipse plugin. I face above error if i try executing it as Runnable JAR file.
Kindly provide necessary help

The error in matlab:Exception in thread "AWT-EventQueue-0" java.lang.​IllegalArg​umentExcep​tion: Comparison method violates its general contract

I started receiving an error in matlab, which prevents me to see the command window but does not prevent the code from executing. I attached all the error message below. I do not know why this is happening but I guess it started after I used "save" commands in the editor. I basically load data into the editor and then preprocess the data so that I can use them later, and I save the new data for future computations. Since when I started saving data, this problem has been initiated. Now, I can't stop matlab to produce this error every time I run any code. Can you please help me with this? I really appreciate that, thank you.
Original error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.ArrayList.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at com.mathworks.widgets.grouptable.GroupingTableUtils.sortNonRecursively(GroupingTableUtils.java:296) at com.mathworks.widgets.grouptable.RowListTransactionTarget.finishTransaction(RowListTransactionTarget.java:115) at com.mathworks.widgets.grouptable.GroupingTableTransaction$1.run(GroupingTableTransaction.java:112) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) >>

Applet not working in Chrome,Firefox but working in IE

I know the subject is similar to some other questions available but none have given satisfactory solution.So here goes the question.I have an applet that works perfectly in IE but doesnt work in Chrome or Firefox.
The trace found in Java console is this:
Java Plug-in 10.25.2.17
Using JRE version 1.7.0_25-b17 Java HotSpot(TM) Client VM
java.security.AccessControlException: access denied ("java.net.SocketPermission" "www.w3.org:80" "connect,resolve")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.nwoods.jgo.svg.DefaultDocument.a(Unknown Source)
at com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc(Unknown Source)
at com.bea.dsp.oam.console.metadatabrowser.datalineage.LineageGraphApplet.start(LineageGraphApplet.java:53)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at com.nwoods.jgo.svg.DefaultElement.getAttribute(Unknown Source)
at com.nwoods.jgo.svg.DefaultDocument.buildJGoDoc(Unknown Source)
at com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc(Unknown Source)
at com.bea.dsp.oam.console.metadatabrowser.datalineage.LineageGraphApplet.start(LineageGraphApplet.java:53)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The applet tag in the page is like this:
<applet width="100%" code="/LineageGraphApplet.class"archive="/DataLineageApplet.jar" style="border:0px" id="lineageapplet" MAYSCRIPT>
<param name="viewDocumentUrl" value="/generateDocument.do?mode=0"/>
</applet>
What could be the issue and how to resolve it?Similar questions have seen answers like open the port or seeing the applet work using applet viewer in conjugation with a security policy file granting all permissions or signing the jar.But I still was not able to make it work on Firefox?
I had a similar issue once - my applet was also running in IE but not in other browsers. However from the amount of information you have given it is difficult to tell. Do you use authentification (like FormLogin, BasicLogin etc) before one can access the applet? If so you can try the following:
Set (thus disable) the cookie-http-only to false.

RealmBase Encryption Issue

i am trying to encrypt password for server.xml using RealmBase
into Tomcat7 through below command:
java -cp bin\tomcat-juli.jar;lib\catalina.jar;lib\tomcat-util.jar; org.apache.catalina.realm.RealmBase -a SHA passwd
and I am facing below error on executing the comman:
C:\Program Files\Apache Software Foundation\Tomcat 7.0>java -cp bin\tomcat-juli.jar;lib\catalina.jar;lib\tomcat-util.jar; org.apache.catalina.realm.RealmBase -a MD5 passwd
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more
C:\Program Files\Apache Software Foundation\Tomcat 7.0>
Try including servlet-api.jar as well.
java -cp bin\tomcat-juli.jar;lib\catalina.jar;lib\tomcat-util.jar;lib\servlet-api.jar org.apache.catalina.realm.RealmBase -a SHA passwd
EDIT
After trying to run this myself, there was yet another class missing. Instead of including every JAR in the classpath manually, I decided it would be easier to just include them all with lib\*. Try this...it works for me!
java -cp bin\tomcat-juli.jar;lib\* org.apache.catalina.realm.RealmBase -a SHA passwd