Update ear in web sphere from command line - java

I have developed an java ear that i deploy from my local eclipse to my local websphere 8.5 by using the publish button in eclipse. When I try to deploy my ear from command line I get an error after I try to access the webpage.
I update my ear from common line like this:
${was.dir}/profiles/${was.profile}/bin/wsadmin.sh -lang jython -username ${was.username} -password ${was.password} -c AdminApplication.updateApplicationUsingDefaultMerge('${was.app.name}', '${build.dir}/${ear.name}')
The deployment is successful but when I access my application thru my web browser I get the following message instead of seeing my application:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /wwww/index.html
I have verified that the ear is ok by updating it thru the web admin interface of websphere without any configuration.
What am I doing wrong or what additional steps do I need to do to successfully update my ear?

You are using wrong command. You should use something like this:
AdminApp.update('MyAppEAR', 'app', '[ -operation update -contents
MyApp.ear -nopreCompileJSPs -installed.ear.destination C:\WAS\MyAppEAR
-nodistributeApp -useMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission ..dll=755#..so=755#..a=755#..sl=755
-noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -MapModulesToServers [[ MyApp MyApp.war,WEB-INF/web.xml WebSphere:cell=Node02Cell,node=Node02,server=server1 ]]]' )
Also, in WebSphere Application Server you can log every command you issue through Administrative Console.
Steps
login to admin console with administrative user (e.g. wasadmin)
click "System Administration" -> "Console Preferences"
check "Enable command assistance notifications" and "Log command assistance commands"
click Apply button to save changes
You can see commands in help portlet on the upper-right side of admin console:
If you checked "Log command assistance commands", you can also see jython commands in a log file "<WAS_HOME>\profiles\<PROFILE_NAME>\logs\server1\commandAssistanceJythonCommands.log"

I'm not sure about updateApplicationUsingDefaultMerge vs update (the latter is what I use), but don't forget you also have to AdminConfig.save() after you're finished.

Related

Application error and logs not loading, what steps to take?

I've been getting the following error page, when visiting my app:
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
However, heroku logs --tail does not return anything. If I go to the dashboard through web (https://dashboard.heroku.com/apps/app-name/logs), the logs window keeps loading but nothing is shown.
I have nothing to go on, and Heroku won't accept a ticket of a free app. Does anyone know any more steps I can take to trace the error?
Additional info:
The build logs all look fine:
BUILD SUCCESSFUL in 49s
5 actionable tasks: 5 executed
Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
Compressing...
Done: 85.2M
Launching...
Released v3
https://app-name.herokuapp.com/ deployed to Heroku
I am creating a spring Java API, it works fine when I try to run it locally. If I try to run it through $heroku local I do get an error:
[FAIL] No Procfile and no package.json file found in Current Directory - See run --help
I had same issue. I just added system.properties to root folder of spring app and this file contained 1 line:
java.runtime.version=11
Heroku procfile documentation.
Spring documentation for Heroku deployment

How to troubleshoot Microsoft Azure WebApp on java? How to access logs?

I have a java-application (standard springboot from default tutorial: https://spring.io/guides/gs/spring-boot-for-azure/ ) that I "successfuly" deploy to my WebApp (created during deployment) via Eclipse/maven plugin azure-webapp:deploy
Once deployed, files are inside the WebApp, I can see them. If start-up is successful I do get running application, but if it is not - I do not know how to troubleshoot. I don't know where to find error logs, what caused the problem and as consequence, how to solve it.
as an example of how to make it fail, add this line:
throw new RuntimeException("Doomed to fail");
I tried enabling logs from "diagnostic logs tab" and expected to see them under LogFiles/Applications but that folder remains empty.
How do I troubleshoot java-application that fails to start in WebApps of Azure?
edit: additional example of Exception to troubleshoot:
public static void main(String[] args) {
throw new RuntimeException("start failure #21");
//SpringApplication.run(Application.class, args);
}
It sounds like you followed the springboot tutorial Deploying a Spring Boot app to Azure to build the GitHub project microsoft/gs-spring-boot and deploy to Azure, but not works.
Here is my steps which I also followed the tutorial, but deployed via my own way.
I created a directory SpringBoot on my local machine, and to do the commands cd SpringBoot and git clone https://github.com/microsoft/gs-spring-boot.
Then, to build it via commands cd gs-spring-boot/complete and mvnw clean package
Note: I reviewed the sections of the tutorial under Create a sample Spring Boot web app which seems to do on Linux, but the web.config file in microsoft/gs-spring-boot/complete is ready to Azure WebApp for Windows. However, there is not any comments to describe the deployment target that be Azure WebApp for Windows or Linux.
So I used my existing WebApp for Windows to test my deployment. I open my Kudu console in browser via the url https://<webapp name>.scm.azurewebsites.net/DebugConsole and drag the files complete/web.config and complete/target/gs-spring-boot-0.1.0.jar to site/wwwroot as the figure below. Then, I started my webapp, and it works fine.
Note: Please check the JAVA_HOME environment variable which has been configured on Azure via command echo %JAVA_HOME% as the figure below.
If not, you need to set Java runtime in the Application settings tab of Azure portal.
Or you can also configure the web.config file to replace the reference %JAVA_HOME% with an existing Java runtime installed in the path D:\Program Files\Java of Azure WebApp, as below.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<!-- <httpPlatform processPath="%JAVA_HOME%\bin\java.exe" -->
<httpPlatform processPath="D:\Program Files\Java\jre1.8.0_181\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\gs-spring-boot-0.1.0.jar"">
</httpPlatform>
</system.webServer>
</configuration>
I didn't manage to find logs in windows based machine, but If you enable logs on linux-based-machine you will see them in the "Diagnostic logs" output. There is a catch though.
There is 230 timeout. It will wait full "timeout" time, until producing logs in the log file, after which you can access them via log file or through "Diagnostic logs". Make sure to enable logging before you start application. This applies to linux based machine, I don't know if it can apply to windows based machine.
Then it waits for an answer trigger. Answer trigger, as it turns out, is a phrase in console output "Application is started in X seconds". I increased the timeout to 500 seconds, because although it starts in 60 seconds on my local machine, it takes 430 seconds on remote-linux-based machine of Microsoft Azure*
Second, I changed the name of my main class from "GameStart" to "Application" and after that it actually caught the trigger. After that the application started. Nowhere in manuals did I find the "until timeout - no logs" and "trigger phrase" clauses mentioned.
ps: For reference, it took me 20 to upload application, 5 minutes to start it. I was using centralUS server, cuz centralEU did not work out for me, as it was even longer, although I'm in central EU myself
-
*using test account. It might happen that on payed account number are either different or similar.

NetBeans Deployment error: Starting of server GlassFish Server is not supported

I am using NetBeans 8.2, GlassFish4.1. When I right click my Java Web project and deploy, a GlassFish Administration Credential window pop up, and an error occurs as follows:
Deployment error: Starting of server GlassFish Server is not supported. Please, start the server manually.
How to get rid of this error?
Problem solved by setting password for admin and enable secure admin. Use the following command would help:
adadmin
change-admin-password
Please notice that the default user name is admin, default password is empty(just press enter).
enable-secure-admin
Enter user name and the new password you have just set.
restart-domain

Connect Eclipse to Websphere Liberty in another computer

I had installed Websphere Liberty Runtime in a Windows 7 machine following the instructions here :
https://developer.ibm.com/wasdev/downloads/liberty-profile-using-non-eclipse-environments/
I had installed and configured the admin-center feature following these instructions :
http://www-01.ibm.com/support/knowledgecenter/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/twlp_ui_setup.html
I set two users : admin and nonadmin
I am able to connect to this server from Eclipse in another computer.
However, each time i try to deploy an application on this server, i get this error in the computer with Eclipse :
Publish HelloWorldApplication
OK
Failed to transfer application HelloWorldApplication
CWWKX0121E: Access denied to path C:/wlp/usr/servers/servername/apps/HelloWorldApplication.war.
Failed to synchronize server configuration.
CWWKX0121E: Access denied to path C:/wlp/usr/servers/servername/server.xml.
Deployment of application HelloWorldApplication failed.
And, in the server i got this :
[ERROR ] CWWKX7901E: The C:/wlp/usr/servers/servername/apps/HelloWorldApplication.war file system path is not valid.
Can anyone help me, please ?
We are more than one developer needing to work on this server.
Thanks in advance.
SJRM
How do you have your server.xml configured? Given the error you mention, I think it's missing the configuration for writing into the remote directories, which looks something like this:
<remoteFileAccess>
<writeDir>${writePath}</writeDir>
</remoteFileAccess>
You can define several write directories and each one can refer to variables or absolute paths, for example:
<remoteFileAccess>
<writeDir>${wlp.user.dir}</writeDir>
</remoteFileAccess>
You can obtain the basic configuration for remote administration by executing this command on you Liberty profile bin directory:
configUtility install remoteAdministration
For reference see:
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/t_creating_remote_server.html?cp=SSEQTP_8.5.5%2F1-3-11-0-2-3 for setting up a remote server,
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_command_configutil.html%23rwlp_command_configutil?cp=SSEQTP_8.5.5%2F1-3-11-0-3-2-1-1&lang=en for reading about the configUtility and
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_dirs.html?cp=SSEQTP_8.5.5%2F1-3-11-0-2-0&lang=en for a list of Liberty profile properties and their corresponding directories.

Running SOLR on a desktop application

**while running solr 4.10.3 solr\examples i ran following command on cmd java -jar start.jar
after this when i go on http://localhost:8983/ i got this error
Error 404 - Not Found.
No context on this server matched or handled this request.
Contexts known to this server are:
/solr ---> o.e.j.w.WebAppContext{/solr,null},D:\solr-4.10.3\exampleD:/solr-4.10.3/example/webapps/solr.war
try http://localhost:8983/solr. By this you are provding the web application within which it might need to find index.* i.e. welcome file.

Categories

Resources