how to delete created server WebSphere Application Server Liberty Profile - websphere-liberty

I am working on docker images
setting up in docker file ...
# - Liberty installation of required features
RUN /opt/wlp/bin/featureManager install adminCenter-1.0 localConnector-1.0 jaxrs-1.1 jsp-2.2 jdbc-4.0 jndi-1.0 cdi-1.0 servlet-3.0 beanValidation-1.0 --when-file-exists=ignore --acceptLicense
RUN /opt/wlp/bin/server create my-server
...
but getting error
CWWKE0005E: The runtime environment could not be launched.
CWWKE0045E: It was not possible to create the server called cca-dist-d because the server directory /srv/www/servers/my-server already exists.
ERROR: Service 'appserver' failed to build: The command '/bin/sh -c /opt/wlp/bin/server create my-server' returned a non-zero code: 1
Is there way to remove such server before creation or any suggestions?
just for notice that rm -R does not work :-(
RUN /bin/bash -c 'rm -R /opt/wlp/bin/server/my-server'
---> Running in 83f*****bd
rm: cannot remove '/opt/wlp/bin/server/my-server': Not a directory

Regarding Liberty profile server deletion, it is as simple as to delete the entire directory. For example
rm -R WLP_HOME/usr/servers/my-server
Now about your error message, you should check why the server exist. Sounds like you have a problem in your setup.
And if you want to delete the my-server anyway, then you should remove the right directory. In your case:
rm -R /srv/www/servers/my-server
The servers are created into servers directory from WLP_USER_DIR environment. And the variable can be used to specify an alternate location for ${wlp.user.dir}. If this is specified, the runtime will look for shared resources and server definitions in the specified directory. Check server start script or README file for more information about the different environment variables.
In your case it seems that the WLP_USER_DIR is /srv/www/

Related

How to run java application automatically when EC2 instance starts without having to run it manually with java -jar file_name-SNAPSHOT.jar?

I tried the following steps but when I access my application in the browser using the url link, it returns a blank page. Here is what I did:
Copy My jar file to /home/ec2-user/
cp myApp-0.0.1-SNAPSHOT.jar /home/ec2-user
Next, I opened the rc.local in the VI editor and appended myApp-0.0.1-SNAPSHOT.jar
vi /etc/rc.local
#
#
#
#
touch /var/lock/subsys/local
//Append the below command:
java -jar /home/ec2-user/myapp-0.0.1-SNAPSHOT.jar
/:wq
Give permission to the symlink by running the following command:
chmod +X /etc/rc.d/rc.local
So I stopped my ec2 instance and after a while, I started it again to see if I was able to test my endpoints without having to manually run my appl with java -jar myApp-0.0.1-SNAPSHOT.jar But it did not succeed. I was told this way of doing is now obsolete. I also tried to follow the following link but the file naming was not obvious to me so I messed up some steps and got to the same result: failed Please can anyone direct me? Thanks! I tried the following steps but when I access my application in the browser using the url link, it returns blank page.

How to send war file from local to aws server using putty?

I am trying to send war file built in Java Web application to AWS EC2 instance. Here is the command which I have far used for sending war file.
cd/ usr/share/tomcat8/webapps/
As I have my previous war file in this folder. After that I have use command ls from which something like this come
com.metokart com.metokart.war host-manager manager ROOT ROOT-OLD-1
At this .war is the previous one, First I have rename the folder ROOT to another name using this command-
sudo mv ROOT ROOT-OLD-6
After that I have deleted both the .war file and com.metokart folder from the webapps
sudo rm -rf com.metokart.war
sudo rm -rf com.metokart
Then I have gone to default directory to upload the new war file
sudo cp -i com.metokart.war /usr/share/tomcat8/webapps/
After that I have change the ROOT folder name back to ROOT.
sudo mv ROOT-OLD-6 ROOT
At last I have restarted my tomcat
sudo services tomcat8 restart
But still I don't know where I am doing the mistake. Hope anyone can help.
You should use pscp from within putty. Here is a helpful link that should guide you https://it.cornell.edu/managed-servers/transfer-files-using-putty.

How to use ssh key inside docker container

I am building dockerfile to create an image where I want to build a package. I want to pull this package inside the docker image. I need to do a git clone for that. I saw the discussion on this post :
Using SSH keys inside docker container
Based on that, here is the content in my Dockerfile :
ENV SSH_HOME /Users/myid
ADD $SSH_HOME/.ssh/id_rsa /root/.ssh/id_rsa
RUN echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
When I run docker build, I am getting an error due to relative path. If I provide absolute path, it says the location is outside of context. Any idea how to fix this? I am running on Mac OSX 10.
With the script above, I am getting the following error :
ADD failed: stat /var/lib/docker/tmp/docker-builder6164655/Users/myid/.ssh/id_rsa: no such file or directory
Looks like it might be related to this bug here
The broken example is very similar to your path problem:
# Dockerfile
FROM ubuntu:14.04
COPY start.sh /start.sh
# comes back with:
stat /var/lib/docker/aufs/mnt/e89417ccaafbc91c3f930b56819427f83b3f2d3b3a246fbd6b48c9abcc7233f6/start.sh: no such file or directory
I'd try
updating to the most recent docker
restarting your docker engine

File is not created in Docker

I am new to Docker and trying to build Docker image. I simply created Docker file but getting some error not able to identify how to resolve this.
My Docker file code is:
FROM ubuntu
MAINTAINER ravat
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
the error I am getting is:
/bin/sh: 1: cannot create /home/ravata/Desktop/DockerDemo/index.html: Directory nonexistent
Not sure why are you trying to create the file at this specific location, but as error hints you, you need to create a folder you'd like to put your file first, e.g.
FROM ubuntu
MAINTAINER ravat
RUN mkdir -p /home/ravata/Desktop/DockerDemo/
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
Just to make it clear, the reason you do not have home folder for username ravata is the fact that no such user exists on brand new ubuntu docker image.
The error message tells you why, /home/ravata/Desktop/DockerDemo/ directory doesn't exists.
You should first create it.
Note that this file will be created inside your container, not on your computer. So directory should be created inside the container, for example with a RUN mkdir ...

Grails create-app error

Anyone know why I would get this error when trying to create a grails app using terminal.
mycomputer:test-apps mailboxe$ grails create-app demo
| Configuring classpath
| Error Error executing script CreateApp: /Users/bla/.grails/ivy-cache/resolved-org.grails.internal-grails-2.0.3.xml (Permission denied) (Use --stacktrace to see the full trace)
As #Phillip Tenn mentions, this is a permissions issue. Chances are something got installed into a cache with the sudo command so the root user owns the file and your normal user can't modify it.
The easiest thing to do is probably to just whack your ~/.grails directory, by default, there isn't anything but cached information in there. So unless you've put something in there manually (like a config file), it's safe to delete and let it regenerate with the next grails command. To do that, just:
cd ~
sudo rm -r .grails
It'll prompt you for your password to ensure you want to run this command as the root user.
Alternatively, you could try to find the offending file and chown it to your user and group (by default on OSX the group is staff). So for this example:
sudo chown bla:staff /Users/bla/.grails/ivy-cache/resolved-org.grails.internal-grails-2.0.3.xml
Grails needs to be able to write to a .grails folder under your user directory.
Without knowing the details of your development environment, the error message you are getting says (Permission denied) when you try to run grails create-app demo.
I would look into your directories:
/Users/bla/.grails/
/Users/bla/.grails/ivy-cache/
and ensure that you have proper write permissions.

Resources