I am encountering some problems when running some PHPUnit Tests in a different directory.
I've searched around; the answer is that I have to change the environment variable KERNEL_DIR.
Any idea how to change this variable?
Based on what kind of pattern, is the folder where HTTPKernel.php is located or some other files located.
Is it to specify the path within the new folder or the path for the original folder?
As seen in the docs:
#phpunit.xml
<php>
<env name="KERNEL_DIR" value="foobar" />
</php>
Related
I am trying to configure EJBCA 6.15.2.1 on Wildfly 12.0.0.Final inside a Docker container with the help of EJBCA .properties files. In $EJBCA_HOME/conf/externalra-gui.properties.sample there is a comment showing that one of the default settings is: appserver.home=${env.APPSRV_HOME}. I tried to set other options in a similar way, e. g. in database.properties: database.datasource=${env.WF_DATASRC}.
I run ant clean deployear and it didn't deploy my EJBCA instance properly at first - server.log showed that there is no datasource under the name "${env.WF_DATASRC}". It proceeded correctly after I'd changed the line to: database.datasource=ejbcads, which is the exact value of the variable and the name of the data source inside the WildFly server.
I get similar errors during further installation steps. Is there another way of setting EJBCA configuration using environment variables?
I'm Setting up Log4j2 in a Spring-boot application. I now want to create a /log directory exactly where the .jar file is located.
This is needed as we start the java application from a startup script and the configuration should work on both windows and unix developer machines as well as a server.
I already tried with:
<RollingFile name="FileAppender" fileName="./logs/mylog.log"
filePattern="logs/mylog-%d{yyyy-MM-dd}-%i.log">
which just creates a log folder at the directory where the jar gets started.
then I read i should use .\log/mylog.log as .\ points to the directory of the jar file.
But then it just creates a folder called .\log.
I also tried with configuration with jvm arguments and calling them at the log4j2.xml with: ${logFile}. Now a directory gets created called '${logFile}.
The only ${} command working is the directory of the log4j configuration file. But as this is inside the jar it just gets me a pretty useless folder structure
Thanks in Advance
EDIT: In the End what I did was setting up two configuration files, log4j2.xml and log4j2-prod.xml
The log4j2.xml took the system property as Vikas Sachdeva mentioned, while the prod.xml got the location hard coded.
Not really the solution I was looking for but made it work.
One solution is to pass log directory location through system properties.
Configuration file will look like -
<RollingFile name="FileAppender" fileName="${sys:basePath}/mylog.log"
filePattern="${sys:basePath}/mylog-%d{yyyy-MM-dd}-%i.log">
Now, pass VM argument basePath with absolute path of directory containing JAR file -
java -jar myapp.jar -DbasePath=/home/ubuntu/app
Suppose I have a Grails application named myCoolApp.
Furthermore, suppose I have defined some basic properties in grails-app/conf/Config.groovy and grails-app/conf/DataSource.groovy under the test and production profiles.
Config.groovy is set to merge with the following .groovy external configuration file, if found at all:
grails.config.locations = ["file:${userHome}/.grails/${appName}-config.groovy"]
Finally, I have also defined, inside an external testing server, such a file, under a local *NIX user path:
/home/appServerTestUser/.grails/myCoolApp-config.groovy
Sadly, I find that for some reason, the external .groovy file's properties are not being merged when a Tomcat instance starts up.
What options do I have to make Grails tell me: "Oh, yes, I found your external config file at: /home/appServerTestUser/.grails/myCoolApp-config.groovy" and these are the properties I merged into Config.groovy?
Thanks!
File-based paths don't make much sense in a deployed app. It could work when deploying on your dev machine for testing, but will likely fail on any other machine. And it'll probably fail locally even if configured with the correct path since the process will like run as a different low-priviledge user.
You can use absolute paths, e.g. /etc/myapp/path/to/file, but this tends to couple deployment to filesystem structure, so if you develop in Windows and deploy on Linux it'd be tricky to get them both working.
So the best bet for Tomcat deployment is to use the classpath syntax. You can specify multiple files and it will load all that it finds, so I usually have one entry for local dev and one for the deployed app:
grails.config.locations = [
"classpath:${appName}-config.groovy",
"file:./${appName}-config.groovy"
]
I delete the entries for .properties files because Groovy syntax is so much more flexible, but use them if you like. I also keep the dev files in the project root (and exclude from source control).
So when deploying, name the file correctly (different apps will have different files, so no clashing there) and put them in Tomcat's lib directory. This is in the classpath, and so the classpath: entry will see it.
I need to add two directories to the environment path, but when I enter the first it gets cut of in the middle. It seems to me my environment path is full(there are quite a lot of things in there).
How can I add my two directories to the environment path?
I'm using Windows 7.
I guess you're working in windows.
Make 2 new environment variables.
Then add the 2 environment variables to the environment path by name like this:
%variable_name1%;%variable_name2%;
In windows:
PATH="PATH1";"PATH2";%PATH%
In Unix:
PATH="PATH":"PATH":%PATH%
Note: Quotes are requires if path contains spaces in between like c:\Program Files\abc
I am using the Ant wldeploy task to deploy a war file.
It is working fine, but the war file path in the deployed server is set to something like
servers/myadminservername/upload/mywarfilename/app
Instead, I would like to set this path myself in the Ant buildfile.
Can any one please help me with that?
The task I am using for this is:
<wldeploy action="deploy" verbose="false" debug="true"
name="ClientProfileSyncPortTypeImplV8"
source="${results.war.file.dir}/ClientProfileSyncPortTypeImplV8.war"
upload="true" adminurl="t3://${serverip}:${port}"
user="${admin_id}"
password="${admin_pw}"
usenonexclusivelock="${lock}"
targets="${target_managed1}">
</wldeploy>
I think you can edit the config.xml and specify the path of your deployment.
The upload, targets and stage / nostage / externalstage attributes of the wldeploy task give some control over where the deployment is made to.
I ended up deleting the app and the deploying it from ant, accepting the path it chooses. Now I can deploy and redeploy just fine. It's really neither here nor there to me where the ear lives - I was just sad that when I deployed in the UI I couldn't redeploy using ant.
I know this is an old post but I have a partial solution for anyone who stumbles across this question
From the path: "domain/servers/myadminservername/upload/mywarfilename/app" you can change the first part of this (You can edit the "servers/myadminservername/upload") to go to any directory relative to the WLS domain.
Go to the Administrator Console (using: serverIP:serverPort/console) and in the left hand side follow the tree:
environment -> servers -> (AdminServerName) -> Configuration -> Deployment -> Upload Directory Name
The "Upload Directory Name" can contain a path to a directory that is relative to the domain.
So at least "domain/servers/myadminservername/upload/mywarfilename/app" can become "domain/path_of_your_choice/mywarfilename/app"
Hope this helps someone