Use WLST to Retrieve Local Application Path - weblogic

I am currently automating a process of moving Weblogic applications from old servers to new servers. I was unable to find a way to list the local application path for a deployed Weblogic application using WLST. The closest I found was:
appInfo=cmo.getAppDeployments()
for app in appInfo:
app_path = getPath(app)
print app_path
which will return something like:
InternalAppDeployments/test.war
This is not the directory I am looking for. I was wondering if someone had some input on how to retrieve the local directory for deployed Weblogic applications.

One easy way to do it with WLST:
ls('/AppDeployments') # this will list all of the deployments
cd('/AppDeployments/<app name>')
cmo.getAbsoluteSourcePath() # this will list the full path
Some things you could try instead of WLST:
Navigate to the /config/ folder and do a:
grep source-path config.xml
This will list the full path to the deployment IF that deployment was deployed with nostage staging-mode. Those paths will be relative if the deployment was deployed with stage for the staging-mode, it will be copied to each managed server that was targeted for the deployment and you will get relative paths like you mentioned above...
Those ear/war files likely live under:
<domain>/servers/<server name>/stage/<deployment name>
Or under
<domain>/sbgen

Related

Why does aspnet_compiler need write access to the Temporary ASP.NET Files folder on my build server?

We use a CI server (Jenkins) to compile an ASP.NET project and deploy to our web servers.
I want to precompile the site before deployment to increase performance, so I've set the PrecompileBeforePublish property in the Publish Profile (.pubxml).
However, when Jenkins runs the build, the AspNetPreCompile task fails with the error:
AspNetPreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe
-v /
-p c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\Source
-c
c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\TempBuildDir
ASPNETCOMPILER : error ASPRUNTIME: The current identity (JenkinsUser)
does not have write access to
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files'.
Note that this is not the machine where the web site will be deployed to, it is just a build server. I could grant the current identity (JenkinsUser) access to the Temporary ASP.NET Files folder, but I'd rather not have to mess around with filesystem permissions on a box that is just acting as a dumb Jenkins slave.
Is there any way around this? Why is aspnet_compiler trying to write the site to the Temporary ASP.NET Files folder, and is there any way to make it use a different temporary directory instead, such as %TEMP%?
I guess you could play around with this:
<AspNetCompiler ToolPath="C:\Windows\Microsoft.NET\Framework\v2.0.50727" VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\Web" />
But you're gonna have to give ~some directory the rights.
It's just one of those "live with it" things.........my instructions document for setting up a CI machine has the "give rights to asp.net directory" as you explain.

not able to deploy war file in jelastic cloud

I developed a web application using java and mongodb. I used glassfish server.
I tried to deploy it on jelastic cloud service
I uploaded my war file. But when I run it after deploying the war file it shows a 404 error. Why? The project works fine on my machine.
There are at least few potential causes:
your app needs some resources which are not started by default (such as DerbyDB). In this case you can check GlassFish log file - server_instance.log for more details.
you are trying to get resources from wrong context, make sure you are trying to get it via correct context name

Glassfish: how to investigate roles/groups problems

I have a Glassfish server in production which uses JDBC Realm for authentication.
It works well, but there is the need to change all the roles/groups. I developed a new version of the web application in a test environment changing glassfish-web.xml and web.xml to align them with the groups contained in the groups table on the db for test. Everything works flawlessly. So I moved the web application to the production environment and updated the content of the groups table on production db.
The authentication works well but roles are not recognized. How can I investigate this problem ? I checked the production db and the groups table is fine and can be accessed for select. Glassfish-web.xml and web.xml are the same of the test enviroment. This is a real brain teaser. The only explanation I can give is that Glassfish-web.xml is discarded for unknown reasons or the old file is still present and read from some other location than web-inf directory.
Thanks for any help
Filippo
Explore your domain's folder under GlassFish root folder + \domains. If you are unsure what domain you are on, it is domain1 by default. Under this folder you should have a folder called applications. This folder contains the deployed version of all your applications, and it's the place where to check your application's Glassfish-web.xml configuration file.
Anyway, if you are having this kind of problems, a Clean & Build of your project, followed by a redeploy, usually works.

myeclipse deployment issue cant see changes

Im trying to work in my project, when I change files it changes the file inside the directory that I imported the projects into my workspace. But the changes aren't showing up on the server because the server is using the folder inside .metadata/webapps/myapp etc
what have I done wrong here?
Sounds like you're deploying to the integrated Tomcat server. The deployment is normally to the .metadata/.me_tcat/webapps/myapp folder. Is this what you meant? If not then I suggest you remove the deployment and then deploy again and let the deployment location default. The folder .metadata/.me_tcap is simply where the integrated Tomcat installation looks for applications when it starts up.
You can check the deployment location by looking in the servers view. Expand the integrated Tomcat server. The deployment location for your project is shown there.
The deployed location should be kept in synch with your code. If that's not happening, it may be that the changes you're making are the kind that require a redeployment. I'm not sure what the conditions are for propagating changes but I guess there might be some situations where changes can't be picked up automatically in this way. The changes should be picked up on a redeploy.
To check, create a new web project, which will create some default configuration and a default index.jsp file. Deploy this to the integrated Tomcat server. Now make a change in the index.jsp file and save it. Check if the change is made in the deployment location, or simply run the server and check that your new index.jsp gets displayed.
For more help, I suggest you post to the forums at www.myeclipseide.com/forums

How can I get aspnet compiler to handle a page that contains an include file

I have a web application that lands on a shared hosting platform for my company. That platform has global header/footer code that all applications on the platform consume using include files. I can't change how the header files are structured and how they are to be cosumed--that is dictated to me by another group. I have a build server that does not has IIS installed by design. I am attempting to use the aspnet_compiler.exe during the build process to generate the precompiled website files for deployment.
However, when the build runs I get errors like this:
/Company/Controls/Header.ascx(7): error ASPPARSE: Failed to map the path '/sites/header.inc'.
The Header.ascx control has this server-side include in the HTML:
<!-- #include virtual="/sites/header.inc" -->
On my local machine, I have created a virtual directory in IIS named "sites" that points to the global header code (which I have also copied to my local machine). This same "sites" virtual exists in IIS on the hosting environment. I would really like to avoid having to install IIS on the build machine because it is a shared build machine and I don't anyone to mistakenly work IIS dependencies into their code. The build machine shouldn't need to have IIS.
What is the best way to get the precompiled site files that aspnet_compiler.exe produces during my build without installing IIS?
Microsoft has a very simple example of how to replace an include statement...
http://support.microsoft.com/kb/306575
Looking at the path of your error it seems you are already using some sort of global user control and I'm guessing this is a file which is reused by other applications or languages so I would suggest coming up with a more custom version with error handling and such since it is working over a mapped drive but the basic answer is you need to read the file and output it to the stream during the Render event.
Don't use server-side includes. They are ancient technology and are disabled on most modern sites.
I recommend you instead create .ascx files to replace each of the .inc files, and use those instead.
Try this:
<!-- #include virtual="~/sites/header.inc" -->
The ~ is a shortcut for "root of the web application."