I'm using log4j under J2SE. I've configured it to use a mailer for a certain type of log event.. When the logger.error triggers I get the following exception:
java.lang.Error: Can't find java.home ??
at sun.net.NetProperties.loadDefaultProperties(NetProperties.java:45)
...
at org.apache.log4j.net.SMTPAppender.sendBuffer(SMTPAppender.java:416)
Anyone run into this before? I have the required mail.jar library included as well.
Any help is appreciated.
Thanks,
Chris
I looked at the source code of NetProperties and the error basically means what it says. The System property called "java.home" is unset. According to the javadoc for System.getProperties(), that property is set automatically by the JVM to the java installation directory.
The only explanation I can think of is that something in your application or some third-party library you are using has explicitly unset that property. That is obviously a bad thing to do ...
Related
Imported the gradle project from the "complete" folder and received the following error:
Groovy:General error during semantic analysis:
java.lang.NoSuchMethodError: 'org.codehaus.groovy.ast.expr.Expression org.codehaus.groovy.ast.tools.GeneralUtils.propX(org.codehaus.groovy.ast.expr.Expression, java.lang.String)'
I am using the latest version of Eclipse, 2020-12, with groovy tools installed.
From grails guide
https://guides.grails.org/gorm-without-grails/guide/index.html
Downloaded code sample from github
https://github.com/grails-guides/gorm-without-grails.git
It seems likely to be a version mismatch, but I cannot determine how to correct this problem.
I have tried to delete the offending file, src/main/groovy/demo/domain/Manufacturer.groovy, and the error appears on the file in this package on line 1.
The error does not appear in any other package. I have done the usual internet searches for resolutions that apply, but have thus far been unable to find a suitable solution. I am hopeful for a suggestion?
I think this error comes from an AST transform that references the older signature of GeneralUtils#propX. This method used to return Expression and was changed to return PropertyExpression.
The bridge method for binary compatibility was missing in groovy-eclipse. https://github.com/groovy/groovy-eclipse/commit/f6f448675d95f858b4ec65b6fc8e55f27ccaaa94
Unable to load a Suite class. This could be due to an error in your runpath.
i am getting this error while trying to run scala test case. kindly suggest.
I have same error message as yours.
What I do is:
In your test run configuration(go "Edit Configuration" > "Use classpath ... of module") select the right module at place the image show.
At least this solve my problem that I target to wrong module. May it help you.
i solved the same problem by checking "Use SBT" option in test run configuration under Edit Configuration>Test Class
I am using API Editor in Mulesoft and I am getting following error
ramlParser: loadPath: loadApi: content/[object Object}: no such path
It seems to be related to inclusions of libraries in main RAML such as:
uses:
myLibrary: !include libraries/myLibraryFile.raml
The libraries exist but still I am getting that error. Only if I remove the include the error goes.
Have any of you got same problem? How did you solve it?
Thanks folks!
When using "uses:" you don't have to put "!include" only the name of the library and the path (without "!include").
See
RAML- !include strange behavior
for a more detailed answer
I'm performing Project-Clean... in Eclipse Mars and getting the following error
Errors occurred during the build.
Errors running builder 'Checkstyle Builder' on project 'MyProject'.
cannot initialize module TreeWalker - Unable to instantiate
'RedundantThrows' class, it is also not possible to instantiate it as
com.puppycrawl.tools.checkstyle.checks.annotation.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.blocks.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.design.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.header.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.imports.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.indentation.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.javadoc.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.metrics.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.modifier.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.naming.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.regexp.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.sizes.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.whitespace.RedundantThrows,
com.puppycrawl.tools.checkstyle.checks.RedundantThrows,
com.puppycrawl.tools.checkstyle.filters.RedundantThrows,
com.puppycrawl.tools.checkstyle.RedundantThrows. Please recheck that class name
is specified as canonical name or read how to configure short name usage
http://checkstyle.sourceforge.net/config.html#Packages. Please also recheck that
provided ClassLoader to Checker is configured correctly.
The CheckStyle plugin version is 6.11.
Could you please help me figuring out what may cause this error. Thanks.
The RedundantThrows check has been removed from Checkstyle. Just remove the <module> entry for it from your checkstyle.xml.
Two issues / questions:
1) In many of the log4j threads / forums / etc., I am seeing the results of defining the log4j.debug containing log4j configuration file references prefixed with "file:" as shown below:
log4j: Using URL [file:/data/app/conf/log4j.properties] for automatic log4j configuration.
In the code I am updating (authored by another developer now working someplace else), I am seeing:
log4j: Using URL [bundleresource://23/log4j.properties] for automatic log4j configuration
What/where is the "bundleresource" as shown above? I am thinking this is a dedicated resource Eclipse plug-in that I have been unable to identify.
2) This question stems from a larger issue of not being able to load a log4j configuration file without explicitly inserting it into the command line arguments of the JVM (e.g., -Dlog4j.configuration). I am replacing an Eclipse plugin-based application on a test server that does not have this command line argument specified in a start up script and is able to correctly fire up with log4j being initialized correctly. When I go to replace this application with the latest build from our source repository, the application fails to locate the log4j configuration file. Any thoughts on why the first application can start up and locate the log4j configuration file while the second (newer) application cannot?
Any help would be greatly appreciated.
Thanks!
Update / Edit
Output from the application with log4j.debug defined:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader#9fe666.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader#9fe666 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader#9fe666.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader#9fe666 class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
You can load a properties file for Log4j by first loading the properties, then tossing it into log4j's property configurator:
Properties props = new Properties();
FileInputStream fis = new FileInputStream("mylog4j.properties");
props.load(fis);
fis.close();
PropertyConfigurator.configure(props);
The bundleresource seems like a library specific thing. I recommend using grep on the sourcecode:
grep -irn ./ -e "bundleresource"