Does IntelliJ support remote deployment to Websphere Liberty? - java

This is a possible duplicate of Intellij docker with live update of EAR inside websphere, but that question is 3 years old and the answer "not supported" is maybe outdated.
Via IntelliJ IDEA (2020.3 Ultimate) on Windows 10, I want to deploy an application (EAR) into a Websphere Liberty server which is running in a docker container. This worked with traditional websphere, now we are switching to WLP. Is this possible at all?
The server is up and running. I'm perfectly able to copy the ear to the (mounted) "dropins" folder and the server picks it up, expands it and deploys it without problems.
I'm also able to attach the debugger in IntelliJ to the server and it will stop at breakpoints, it can even successfully update code ("hot swap classes").
What I did already:
I configured ports (7777,8880,9043,9443,9080) to forward 1:1 from the container to my local machine. I can successfully access at least port 9080 through a local browser.
I downloaded Websphere Liberty, Full Java EE 8 Profile, the same version as in the docker container, from IBM official website to my local hard drive, and expanded the zip.
Then I tried to follow the guide https://www.jetbrains.com/help/idea/run-debug-configuration-websphere-server.html and added a Run/Debug Configuration "Websphere Remote", I chose the expanded folder for IntelliJ for the "Application Server" configuration (I know that IntelliJ needed a local installation of Websphere for traditional version, so this may hold true for WLP as well).
I added the EAR-artifact for deployment in the Run Configuration. I copied the server name from the one inside docker and set the connection settings (localhost:9080).
The first try ("Test Connection") resulted in an error from IntelliJ: Error running 'WebSphere Application': JMX file not found: C:\[...]\wlp-javaee8-20.0.0.12\usr\servers\defaultServer\workarea\com.ibm.ws.jmx.local.address
Then I tried and copied this file from my docker container, it had the content
service:jmx:rmi://127.0.0.1/stub/[... some seemingly byte64-encoded string] to the local path. This resulted in a different error: Error connecting to the Application Server: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect
I also tried to use the content of the file com.ibm.ws.jmx.rest.address which was service:jmx:rest://localhost:9443/IBMJMXConnectorREST, (where I replaced the internal host name of the docker container by "localhost"), but that resulted in Error running 'WebSphere Application': java.net.MalformedURLException: Unsupported protocol: rest
If I start the local server on my machine (not in docker), connection works and deployment too. But this is not my aim.
PS: My server.xml contains <applicationMonitor updateTrigger="mbean"/>.

Related

Payara 5.2022.2 Can not deploy modules to context-root /

Environment details:
Payara 5.2022.2
Windows Server 2019 Enterprise LTSC
Apache Netbeans 14
JDK 17
This is the only machine and environment that produces this error when I try to deploy the same program to it:
The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 4 seconds)
SEVERE: Exception while loading the app
SEVERE: Exception while loading the app : java.lang.Exception: Virtual server __asadmin already has a web module __admingui loaded at / therefore web module OIUSA_1 cannot be loaded at this context path on this virtual server
From other questions I have gathered that something is wrong with the server-config->Virtual Servers config of Payara, so here are two photos showing the only discernable difference between a working install of Payara, and the Windows Server that gives an error:
Working server:
Not working server:
So, the virtual server named server in the WORKING installation of Payara has a context path of / but the non working version doesn't. I'm not sure how to fix this, since I have tried fully uninstalling, rebooting, and re-installing.
I came up with a solution:
In the glassfish-web.xml of the application configuration set the Context Root = /your_project_name
Then, deploy the application like expected and it should come up. Then enter the admin domain console and navigate to configurations->server-config->virtual servers-> then select the virtual server your application is running on and set the Default Web Module to your application. This will give the same result of running the application in the root folder (/). No deleting stuff from configuration files needed.

The Tomcat installation directory is not valid. It is missing expected file or folder tcruntime-ctl.sh

Even after searching too much i couldn't find any suitable answer for my problem.
I am using Spring Tool Suite and trying to create a new server but getting error as The specified server is not valid. The .tc-runtime-instance file is missing.
So, I tried updating pivotal using Windows> Preferences and tried editing pivotal with new release but got the error as attached:
I tried changing tomcat version from 9 to 7 too but still no success. Please help.
It looks like you are trying to use the server adapter for the "Pivotal tc Server" to configure your server in the IDE. This server adapter is for the Pivotal tc Server only and doesn't work with a plain Tomcat installation on your disc. For that, you should select the "Apache Tomcat" server adapter when creating a server instance in your IDE.

Confluence configuration Spring Application context has not been set

I tried to install confluence on my own ubuntu server, but always failed. The error is:
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Spring Application context has not been set
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
caused by: java.lang.IllegalStateException: Spring Application context has not been set
at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48)
I saw some solutions in the jira confluence forum saying try to fix the permission of installed directory and home directory. I tried but failed again. How can I fix the problem.
In my case the issue was corrupted confluence.cfg.xml file (contains DB connection stings and other settings). The file size was 0 bytes.
I would suggest to use a VM to create a new installation and borrow confluence.cfg.xml from that installation.
It's embarrassing that this behavior has been allowed to exist for nearly 7 years in a commercial product. This is a basic stuff...
I wish that was on instructions somewhere:
Make single backup copy of confluence.cfg.xml immediately before any writes to it by the application. Application should be able to restore from backed up copy if it gets corrupted.
Atlassian documentation lists the following causes of this problem:
The user running Confluence does not have write permissions to the home folder defined in <install>/confluence/WEB-INF/classes/confluence-init.properties or the install directory.
You are running Confluence as the root user or if you have an application firewall enabled (SeLinux or AppArmor).
The database driver is not located in the <install>/confluence/WEB-INF/lib folder or you are using a database version that is incompatible with the bundled driver.
The hostname of the server can not be resolved.
In my case I was running it as root user inside docker container.

Eclipse - Could not publish server configuration for Tomcat8.0 server at localhost

I have created some example web service methods and trying to publish in my localhost with Tomcat v8.0. I use Eclipse Java EE IDE for Web Developers with Mars version 4.5.0.
I configured the server Tomcat v8.0. I got the configured server in Eclipe's Servers list. I Start the server. But Eclipse prompts saying
Publishing to tomcat v8.0 Server at localhost..." has encountered a problem.
And the error details shows that Multiple context have a path for /HelloWorldServlet and /com.vogeila.jersy.first. These are the servlet projects I created in my workspace.
You can refer this screen shot:
I followed this answer.
"Server Tomcat v7.0 Server at localhost failed to start" without stack trace while it works in terminal
But It didn't work for my case.
Share your ideas.
The prompted message helped me. The Server.xml file under Servers has multiple entries of <Context> tag. I deleted everything by leaving only one entry. It worked for me. 
Delete Existing tomcat server...
Then add new server.. its work for me

Eclipse : Failed to connect to remote VM. Connection refused. [duplicate]

This question already has answers here:
Eclipse Error: "Failed to connect to remote VM"
(26 answers)
Closed 9 years ago.
When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.
What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..
when you have Failed to connect to remote VM Connection refused error, restart your eclipse
Which server are you using?
Like already said:
In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
You'll have to set the JVM property of the server to debug
For Glassfish:
Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:
create file debug.bat/.sh (depending on your OS) in %TOMCAT_HOME%/bin directory and write
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.
After you've created this file start server by executing debug.bat/.sh.
Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.
Hope this helped! Have Fun!
EDIT
If you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
To set your server into debug-mode please try the following:
Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
In Java tab, add this line to Java:
options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Sometimes the port which you are trying to access, gets occupied and won't be released.
Try some tools to find whether the port is in use or not.
I also faced the same issue. I tried giving different port numbers but unfortunately it didn't work. I tried restarting the system (not the application server), and it worked :)
I faced the same issue. But i resolved it by changing my port numbers to different one.
The port number in the Eclipse configuration and the port number of
your application might not be the same.
You might not have been started your application with the right
parameters.
Those are the simple problems when I have faced "Connection refused" error.
As suat said, most of the time the connection refused is due to the fact that the port you set up is in use or there is a difference between the port number in your remote application debugging configuration in Eclipse and the port number used in the address attribute in
-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n.
Check those things. Thanks!
If you need to debug an application working on Tomcat, make sure that your Tomcat-folder/bin/startup.bat (if using windows) contains the following lines:
set JPDA_TRANSPORT="dt_socket"
set JPDA_ADDRESS=8000
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
I ran into this problem debugging play framework version 2.x, turned out the server hadn't been started even though the play debug run command was issued. After a first request to the webserver which caused the play framework to really start the application at port 9000, I was able to connect properly to the debug port 9999 from eclipse.
[info] play - Application started (Dev)
The text above was shown in the console when the message above appeared, indicating why eclipse couldn't connect before first http request.

Categories