I am attempting to set up a Jetty Webapp project in Eclipse Neon and am getting the following error:
Generated servlet error: The type java.lang.CharSequence cannot be resolved
Based on this related post and a few others, I’ve been led to believe this being caused by a version mismatch between Java 7 and Java 8. The project also runs properly on other machines, which also would imply the issue is with my configuration. The accepted answer to the linked post is to either roll back to Java 7, or change the source level of the project to 8. Rolling back to 7 is not an option for me, as the project makes use of Java 8 features.
Im pretty sure I have everything set up for Java 8, but I’m not real experienced in Eclipse, so there could be a setting Im missing. I have set:
in Eclipse->Preferences->Java->Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Build Path->Libraries the JRE System Library is 1.8.0_77
in Run->Run Configurations->Jetty Webapp:
Jetty Version is Jetty 7.6.8v20121106
JRE is Project JRE (1.8.0_77)
I have also cleaned, rebuilt, removed and reimported the project, and restarted Eclipse.
Are there any settings I am missing that might still be set to Java 7?
Or is there some other reason why I would be getting this error?
the full error message is:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The method replace(char, char) in the type String is not applicable for the arguments (String, String)||
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
Also, the line in question is:
<a title=" <%= request.getAttribute("title").toString().replace("],", "\n") %>"></a>
Related
I have just updated java on my archlinux server and now it mess up my tomcat projects.
I want to downgrade java from 11.0.17.u1 to 11.0.13.u8
I looked at my var/cache/pacman/pkg folder and it seems like my old package are still there
jre11-openjdk-11.0.13.u8-1-x86_64.pkg.tar.zst
jre11-openjdk-headless-11.0.13.u8-1-x86_64.pkg.tar.zst
I am trying to run this command to force the installation of this java version :
sudo pacman -U jre11-openjdk-11.0.13.u8-1-x86_64.pkg.tar.zst
But it does not let me and I get this message :
loading packages...
warning: downgrading package jre11-openjdk (11.0.17.u1-1 => 11.0.13.u8-1)
resolving dependencies...
warning: cannot resolve "jre11-openjdk-headless=11.0.13.u8-1", a dependency of "jre11-openjdk"
:: The following package cannot be upgraded due to unresolvable dependencies:
jre11-openjdk
What can I do to force the downgrade?
Further infos:
This is the error I am getting since I updated the JVM
09-Jan-2023 15:46:44.910 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches Failed to clear soft references from ObjectStreamClass$Caches for web application [docs]
java.lang.ClassCastException: class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader 'bootstrap')
The tomcat servers I have not restarted yet (which are still running under the old jvm are doing just fine.
I found this topic here :
ClassCastException when stopping Tomcat 10 inside Eclipse
The solution that is brought is to upgrade the tomcat version. I am in an emergency situation where I don't have the time to update all my tomcat servers right now.
I'm using log4j 2.11.1 in my project and created some custom appenders and configuration factories using the #Plugin annotation.
This compiles just fine without errors both in Eclipse 4.9 and with IntelliJ. However, running the Eclipse batch compiler the same code fails with a IllegalArgumentException:
Processing annotations
java.lang.IllegalArgumentException: Unknown location : CLASS_OUTPUT
at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getFileForOutput(EclipseFileManager.java:436)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchFilerImpl.createResource(BatchFilerImpl.java:89)
at org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.writeCacheFile(PluginProcessor.java:117)
at org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.process(PluginProcessor.java:78)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:142)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:124)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:162)
at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:940)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:450)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4693)
at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1781)
at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1485)
Processing annotations
No elements to process
1. ERROR: Unknown location : CLASS_OUTPUT
1 problem (1 error)
In this repo I made a minimal project to reproduce this issue. I tried using versions 4.7 and 4.9 of ECJ and tried with Java 8 OpenJDK and Oracle, all of it in a Ubuntu 18.04 machine.
Any clue of what could be happening here?
Edit:
Tried using Java10 on a OSX machine and the same error appears.
I'm trying to install java jdk 8 onto an ubuntu 16.04 instance using chef-run. Although when it attempts to install I get Failed to converge target, when I open the logs I have the following:
[2018-06-21T20:24:34+01:00] ERROR: Remote chef-client error follows:
[2018-06-21T20:24:34+01:00] ERROR: SyntaxError: /var/chef-workstation/cache/cookbooks/windows/resources/share.rb:275: syntax error, unexpected end-of-input, expecting keyword_end
I have the following structure in my chef-repo:
cookbooks
-- jdk
-- attributes
-- default.rb
-- recipes
-- default.rb
metadata.rb
Within attributes/default.rb:
default['java']['install_flavor'] = 'openjdk'
default['java']['jdk'] = '8'
Within recipes/default.rb:
include_recipe 'java'
Within metadata.rb:
name 'name'
maintainer 'maintainer'
maintainer_email 'maintainer_email#email.com'
license 'MIT'
description 'Installs/Configures java'
long_description 'Installs/Configures java'
version '0.1.0'
chef_version '>= 12.14' if respond_to?(:chef_version)
depends 'java', '~> 2.1.0'
I can't see what the error is being caused by. Any help on this would be appreciated.
Edit:
If it helps the command i'm using with arguments is the following:
chef-run -i ~/.ssh/key jack#host jdk
This issue should be resolved in the latest stable version 0.1.139.
This is a bug in ChefDK 3.0 when using policy tarball exports. It will be fixed in ChefDK 3.1 next week. In the mean time, add this to your knife.rb config file:
require "mixlib/archive/lib_archive"
Mixlib::Archive::LibArchive.define_singleton_method(:new) { raise LoadError }
Just make sure you remove it when you upgrade to 3.1.
I am getting the below error while trying to publish the application EAR in the server.
Deployment from com.ibm.etools.ejbdeploy.EJBDeployer had errors:
RMIC Command returns RC = MyApplicationEJB. The problems which stopped RMIC are displayed, and have also been recorded in the .log file in error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/ejb/RemoveException, method=<init>()V, pc=0
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.lang.ClassLoader.defineClass(ClassLoader.java:212)
at com.ibm.tools.rmic.iiop.DirectoryLoader.loadClass(DirectoryLoader.java:149)
at com.ibm.tools.rmic.iiop.CompoundType.loadClass(CompoundType.java:354)
at com.ibm.tools.rmic.iiop.Type.initClass(Type.java:1008)
at com.ibm.tools.rmic.iiop.Type.setRepositoryID(Type.java:1025)
at com.ibm.tools.rmic.iiop.CompoundType.initialize(CompoundType.java:762)
at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:323)
at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:131)
at com.ibm.tools.rmic.iiop.CompoundType.getMethodExceptions(CompoundType.java:1678)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2457)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:852)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2408)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1455)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:166)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:892)
at com.ibm.tools.rmic.iiop.ClassType.initParents(ClassType.java:197)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:156)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:151)
at com.ibm.tools.rmic.iiop.Generator.generate(Generator.java:285)
at sun.rmi.rmic.Main.doCompile(Main.java:547)
at sun.rmi.rmic.Main.compile(Main.java:148)
at sun.rmi.rmic.Main.main(Main.java:786)
1 error
Can anybody please help me out in this.
I am using - Websphere 9.1 and jdk 1.6. Interesting thing is my colleagues who have a lower version of Websphere - 8.0, do not get this error.
UPDATE: My Websphere's Runtime Environment is - WebSphere Application Server v7.0
In general a ClassFormatError means that the class with the error was compiled at a java level that is greater than the java level being used at runtime.
In the case of WebSphere v9.0 (which only support Java 8+), the javax/ejb/RemoveException class is compiled at the Java 7 level, so running WAS on Java 6 with a class compiled at the Java 7 or higher level will result in a ClassFormatError.
Update:
You have mentioned in the comments that you are using WAS v7.0 and not WAS v9. The overall explanation is the same regardless of what version of WAS you are using, namely, you can't run on a lower java level than what the classes were compiled with.
I recommend checking what java version the javax/ejb/RemoveException class in your WAS install was compiled at, and compare it to the java level you are running on.
I want to do something with the HypergraphDB in Java. I'm not very familiar with this language and IDE Netbeans.
I followed steps describing the HGDB installation:Link to tutorial
Now I want to write an example in Java (using NetbeansIDE).
So I created new project, added refferences to the downloaded libraries. OK, now I'm able to import packages with HGDB. The only thing I have in my main method is HyperGraph HG = new HyperGraph(dbLocation);. This code compiles. But get following runtime error:
run:
checkpoint kbytes:0
checkpoint minutes:0
java.lang.IllegalStateException: There is 1 existing transaction opened against the Environment.
Aborting open transactions ...
aborting <Transaction id="28">
at com.sleepycat.je.Environment.close(Environment.java:383)
at org.hypergraphdb.storage.bje.BJEStorageImplementation.shutdown(BJEStorageImplementation.java:178)
at org.hypergraphdb.HGStore.close(HGStore.java:355)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:392)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Exception in thread "main" org.hypergraphdb.HGException: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:395)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Caused by: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.storage.bje.BJEStorageImplementation.store(BJEStorageImplementation.java:234)
at org.hypergraphdb.HGStore.store(HGStore.java:119)
at org.hypergraphdb.HGTypeSystem.addPrimitiveTypeToStore(HGTypeSystem.java:185)
at org.hypergraphdb.HGTypeSystem.bootstrap(HGTypeSystem.java:234)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:355)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
I guess it's caused by the native API of the BerkeleyDB.
According to the tutorial, in project options I supply the -Djava.library.path=$HGDB_ROOT/lib/native/$PLATFORM argument on Run card as a VM Option. Instead of the system variables I use full-path to the libraries.
My OS in Windows7. I'm not sure about using slashes or backslashes or double-backslashes as a path-separator.?
So a simply question is: how have I to set up the IDE for using the HypergraphDB?
Thank you for advices!
Judging from the stack trace, you are using the latest version of HyperGraphDB. In that version, the native API is not used. Rather, it's Java only libraries. You have to include the BerkeleyDB Java Edition 5.0.34 jar in your runtime classpath. You can get it either from the Oracle http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html or from the HyperGraphDB Maven repository: http://hypergraphdb.org/maven/org/hypergraphdb/hgbdbje/1.2/hgbdbje-1.2.jar
I had the same issue. I fixed it (by accident) by fixing the order of the libraries on which you're HyperGraphDB application relies on. The library je-[version].jar has to be ABOVE (and hence to be referenced before) db-[version].jar