I am trying to run https://github.com/apereo/cas-overlay-template on Windows 11 and JDK 11 (Eclipse Adoptium 11.0.16.1), using the 6.5 branch. I have ran the "createKeystore" and "copyCasConfiguration" gradle tasks using gradlew.bat, and it created the files below:
c:/etc/cas/cas.crt
c:/etc/cas/thekeystore
c:/etc/cas/config/cas.properties
c:/etc/cas/config/log4j2.xml
when I tried to run "gradlew.bat run", it hit the following error:
2022-08-22 20:26:06,670 WARN [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: FaException in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
at org.apereo.cas.web.CasWebApplication.main(CasWebApplication.java:62)
... 8 more
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229)
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 21 more
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:238)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213)
... 23 more
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1077)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:234)
... 25 more
Caused by: java.lang.IllegalArgumentException: \etc\cas\thekeystore (The system cannot find the path specified)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:107)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:235)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1227)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1313)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:614)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1074)
... 27 more
Caused by: java.io.FileNotFoundException: \etc\cas\thekeystore (The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:199)
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:207)
at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:283)
at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:247)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:105)
... 33 more
I believe this is due to Gradle thinking its running inside a Unix environment instead of a Windows one. Any changes I make to the c:/etc/cas/config/cas.properties file is ignored, which makes me believe that its looking elsewhere for the cas folder (not c:/etc/cas). Anyone got any ideas?
You can change the keystore location in spring config. You can pass the property either in cas.properties or with command line flags or ENV. Two examples:
Example: absolute windwos path
server.ssl.key-store=D:/dev/cas/etc/theKeystore.jks
Example: relative path
server.ssl.key-store=file:etc/cas/thekeystore
By the way, you can also change the location of the cas.properties file with the cas.standalone.configurationDirectory parameter. This is how I usually work in a local environment on Windows:
java -jar build/libs/cas.war --cas.standalone.configurationDirectory=etc/cas/config --debug
Anyone got any ideas?
Please read:
https://apereo.github.io/cas/6.5.x/installation/Troubleshooting-Guide.html#review-logs
CAS server logs are the best resource for determining the root cause of the problem, provided you have configured the appropriate log levels. Specifically you want to make sure DEBUG levels are turned on the org.apereo package in the log configuration
You could consider moving the configuration inside the CAS build itself in an application.yml file, instead of keeping it outside.
https://apereo.github.io/cas/6.5.x/configuration/Configuration-Server-Management-Standalone.html
Try switching from tomcat to jetty as an embedded servlet server. It seems to have better windows support, and properly looks for c:\etc\cas\thekeystore.
To do that just replace -tomcat with -jetty as appServer in the gradle.properties file.
There might be a way to teach tomcat to look at the right place, but I didn't found it. The server.ssl.key-store setting didn't had any effect.
Related
on a Linux machine the container runs inside an exception which I don't understand.
With ejbContainer = EJBContainer.createEJBContainer(); the embaddable container will be started.
In the log file I see an exception:
Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.IllegalStateException: Could not find beans for Type=class org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder and qualifiers:[]
at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:377)
at org.apache.webbeans.event.NotificationManager.invokeObserverMethod(NotificationManager.java:1146)
at org.apache.webbeans.event.NotificationManager.doFireSync(NotificationManager.java:1009)
... 84 common frames omitted
Caused by: java.lang.IllegalStateException: Could not find beans for Type=class org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder and qualifiers:[]
at org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:154)
at org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension.initializeDeltaSpikeContexts(DeltaSpikeContextExtension.java:86)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:410)
at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:86)
at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:371)
... 86 common frames omitted
ERROR javax.enterprise.inject.spi.DeploymentException: couldn't start owb context
Honestly I have no idea what's going on.
Before I found this line:
System.setProperty("openejb.deployments.classpath.include",
".*deltaspike-cdictrl-owb-.*.jar|.*deltaspike-servlet-module-impl-.*.jar|.*deltaspike-servlet-module-api-.*.jar|.*deltaspike-core-api-.*.jar|.*deltaspike-core-impl-.*.jar");
Does anybody have an idea how I can fix this issue?
Thanks,
Markus
One of my colleagues was able to find out the reason.
The regex expression seems to be different between Tomee 7.1.4 and Tomee 8.0.13.
This regex find the libs and solves the probelem.
System.setProperty("openejb.deployments.classpath.include",".*deltaspike.*");
After installing the sonarLint plugin in offline mode on eclipse, and after restarting eclipse, this error was displayed :
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
The full log is :
Unable to start standalone SonarLint engine
java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonarsource.sonarlint.core.container.ComponentContainer.getComponentByType(ComponentContainer.java:258)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleRepositoryContainer.doAfterStart(StandaloneRuleRepositoryContainer.java:64)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.loadRulesAndActiveRulesFromPlugins(StandaloneGlobalContainer.java:126)
at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.doAfterStart(StandaloneGlobalContainer.java:99)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.start(StandaloneSonarLintEngineImpl.java:64)
at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.<init>(StandaloneSonarLintEngineImpl.java:52)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.getClient(StandaloneSonarLintClientFacade.java:60)
at org.sonarlint.eclipse.core.internal.jobs.StandaloneSonarLintClientFacade.runAnalysis(StandaloneSonarLintClientFacade.java:74)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:456)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.runAnalysisAndUpdateMarkers(AnalyzeProjectJob.java:204)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:160)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.runInWorkspace(AbstractSonarProjectJob.java:43)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:59)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:112)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 18 more
Caused by: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because the return value of "javax.script.ScriptEngineManager.getEngineByName(String)" is null
at org.sonarsource.analyzer.commons.JsonParser.<init>(JsonParser.java:36)
at org.sonarsource.analyzer.commons.ProfileDefinitionReader.loadActiveKeysFromJsonProfile(ProfileDefinitionReader.java:59)
at org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(RuleMetadataLoader.java:60)
at org.sonar.plugins.php.PHPRulesDefinition.define(PHPRulesDefinition.java:37)
at org.sonarsource.sonarlint.core.container.standalone.rule.StandaloneRuleDefinitionsLoader.<init>(StandaloneRuleDefinitionsLoader.java:39)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonarsource.sonarlint.core.container.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:57)
... 33 more
Found 0 issue(s)
According to the log, the JavaScript engine is missing, which was included in older Java versions, but has been removed in Java 15.
Make sure, your SonarLint is up to date. For offline installation you can grab the latest release from https://binaries.sonarsource.com/SonarLint-for-Eclipse/releases, which is currently, 5.9.0.31414.
Running my springboot web service java jar app on ubuntu server results in the error shown below, I have done a bit of research about the error however I cannot get a solution. The command I am using to run the jar file is
java -jar mySpringBootApp.jar
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at aacctt.payments.org.Application.main(Application.java:18) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:182) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:162) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
... 16 common frames omitted
Caused by: java.io.IOException: Read-only file system
at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.8.0_191]
at java.io.File.createTempFile(File.java:2024) ~[na:1.8.0_191]
at java.io.File.createTempFile(File.java:2070) ~[na:1.8.0_191]
at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:173) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
... 19 common frames omitted
Try any of the following:
1) Change permissions of /tmp to give access to your user.
chmod -R 777 /tmp
make you sure you run above command with sudo access (root)
2) add the user who is to the sudo group.
In case you are getting this issue while deploying Spring boot application in Kubernetes, one of configuration worth checking is readOnlyRootFilesystem. It must be set to false until you are trying to intentionally run read only containers.
It can be used in deployment config as following:
template:
metadata:
labels:
app: hello
spec:
containers:
- name: hello
image: hello-world
securityContext:
runAsUser: 1000
readOnlyRootFilesystem: false ## this should not be true
For ones who are getting same exception while running from Intellij IDEA when providing env variables as part of run/debug configuration:
please look if "Include parent environment variables" is checked
your application user probably does not have sufficient permissions to crate anything in /tmp directory ... see last message Caused by: java.io.IOException: Read-only file system
The most likely explanation for this is that the root filesystem is full. It was the issue for me.
One reason for this error is that you not include system environments variables. Maybe you try to define a new configuration with different system variables that are defined in your java IDE and you disable default environments variable.
Please enable checkbox:
Run/Debug Configuration -> select your configuration -> press on the environment variables -> check Include system environment variables (as in the picture added above).
Keep in mind that you need to check if you have added the path of the Temp file in the system variables.
I'm trying to get Intellij IDEA to work with a Wildfly 10 server. I installed Intellij following this and Wildfly thanks to this script.
The startup script used by Intellij is /opt/wildfly-10.0.0.Final/bin/standalone.sh, which I tried to run manually, and I got the following error :
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/wildfly
JAVA: /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
=========================================================================
java.lang.IllegalArgumentException: Failed to instantiate class "org.jboss.logmanager.handlers.PeriodicRotatingFileHandler" for handler "FILE"
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:116)
at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:335)
at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:288)
at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:297)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:546)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:514)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:476)
at java.util.logging.LogManager$3.run(LogManager.java:399)
at java.util.logging.LogManager$3.run(LogManager.java:396)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
at java.util.logging.LogManager.access$800(LogManager.java:145)
at java.util.logging.LogManager$2.run(LogManager.java:345)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at org.jboss.modules.Main.main(Main.java:482)
Caused by: java.lang.reflect.InvocationTargetException
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.jboss.logmanager.config.AbstractPropertyConfiguration$ConstructAction.validate(AbstractPropertyConfiguration.java:114)
... 17 more
Caused by: java.io.FileNotFoundException: /opt/wildfly/standalone/log/server.log (Permission non accordée)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:151)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.setFile(PeriodicRotatingFileHandler.java:102)
at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:189)
at org.jboss.logmanager.handlers.FileHandler.<init>(FileHandler.java:119)
at org.jboss.logmanager.handlers.PeriodicRotatingFileHandler.<init>(PeriodicRotatingFileHandler.java:70)
... 22 more
java.util.concurrent.ExecutionException: Operation failed
at org.jboss.threads.AsyncFutureTask.operationFailed(AsyncFutureTask.java:74)
at org.jboss.threads.AsyncFutureTask.get(AsyncFutureTask.java:268)
at org.jboss.as.server.Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.modules.Module.run(Module.java:329)
at org.jboss.modules.Main.main(Main.java:507)
Caused by: org.jboss.msc.service.StartException in service jboss.as: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: WFLYDR0006: Directory /opt/wildfly/standalone/data/content is not writable
at org.jboss.as.repository.ContentRepository$Factory$ContentRepositoryImpl.<init>(ContentRepository.java:188)
at org.jboss.as.repository.ContentRepository$Factory.addService(ContentRepository.java:154)
at org.jboss.as.server.ApplicationServerService.start(ApplicationServerService.java:146)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
This is exactly the same I get as output in Intellij.
I found thanks to this topic that it may be a matter of user permissions.
However, when I try to add a user to wildfly with the add-user.sh script, I get this error : ./add-user.sh: 1: eval: /usr/lib/jvm/jdk1.8.0_60/bin/java: not found
It is looking for a wrong JDK path. I tried to change it following different solutions but none of them work.
My JAVA_HOME is set to /usr/lib/jvm/java-8-oracle .
Is any of you having an idea of what to do ? Thank you in advance :)
Forget the add-user.sh script. This is for adding users to wildfly. Your issue is with your Linux users.
The directory has to be writable by whatever user wildfly is running as.
If you are running it as a user named wildfly then you have to change the ownership of those directories to that user. According to your question it looks like you are running as some other user that does not have permissions to those directories.
If you want a quick easy fix and you aren't worried about other users on the system you could just change permissions like:
sudo chmod -R 766 /opt/wildfly/standalone/
This will give the owner all permissions, and other users read/write permissions to those directories.
This is not best practice. Best practice is to give that directory ownership to user 'wildfly' with permissions of 600. Then you should run wildfly as the 'wildfly' user on linux. Any startup script you can find will likely do this for you.
We are seeing the same as described at Strange Atomikos exception - Error in init(): Log already in use? except we've followed the documentation and specified a logging directory and base name as -D parameters. In our case it's a war file deployed into a naive Tomcat7 container instance.
There is no evidence in the log that the system properties are being read.
This is with 3.9.3 of Atomikos.
tomcat7 11466 2.5 0.7 2311632 257256 ? Sl 09:13 0:19 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomca 7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Dserver.properties.file=/usr/share/tomcat7/server-internal.properties -Dcom.atomikos.icatch.log_base_dir=/var/log/tomcat7/ -Dcom.atomikos.icatch.log_base_name=rest-tm -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
The stacktrace:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.transaction.TransactionManager]: Factory method 'atomikosTransactionManager' threw exception; nested exception is java.lang.IllegalStateException: Can't overwrite cause with java.lang.RuntimeException: Log already in use?
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591)
... 44 more
Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.RuntimeException: Log already in use?
at java.lang.Throwable.initCause(Throwable.java:456)
at com.atomikos.icatch.standalone.UserTransactionServiceImp.init(UserTransactionServiceImp.java:326)
at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:405)
at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:569)
at com.atomikos.icatch.jta.UserTransactionManager.startupTransactionService(UserTransactionManager.java:89)
at com.atomikos.icatch.jta.UserTransactionManager.checkSetup(UserTransactionManager.java:77)
at com.atomikos.icatch.jta.UserTransactionManager.setTransactionTimeout(UserTransactionManager.java:237)
at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig.atomikosTransactionManager(AtomikosTransactionManagerConfig.java:29)
at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd.CGLIB$atomikosTransactionManager$0()
at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd$$FastClassBySpringCGLIB$$10e69a5.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd.atomikosTransactionManager()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 45 more
Caused by: com.atomikos.icatch.SysException: Error in init(): Log already in use?
... 62 more
Caused by: java.lang.RuntimeException: Log already in use?
at com.atomikos.icatch.standalone.UserTransactionServiceImp.createDefault(UserTransactionServiceImp.java:203)
at com.atomikos.icatch.standalone.UserTransactionServiceImp.init(UserTransactionServiceImp.java:258)
I have no idea where I'm supposed to go at this point - I might have hoped that whatever file-name it was trying to open would have been included in the logs but I'm flying blind. There is no file created inside /var/log/tomcat7 except the usual catalina and localhost logs.
Ideas?
That's because the application hasn't closed cleanly and it left some residual log locks that then prevent it from starting.
You'll need to find the tmlogs folder of your application. Under that, you'll find an .epoch file and a .lck file. Delete those and your application should start up fine.