Tomcat 9 in IntelliJ Idea - intellij-idea

I've always used Eclipse as IDE, and after adding external server Tomcat, it used to create me an instance of the server, where I edited the context.xml by adding the resource for my application, then the data to access the database, how can I do that same for IntelliJ?
At the moment I was forced to add the resource in the context.xml in the folder where I have the tomcat installation.
I tried also with Smart Tomcat plugin for IntelliJ

You can specify a custom Tomcat Context Descriptor under File | Project Structure | Facets | Web:

Related

Is there a way to get PhpStorm/WebStorm to use a custom domain in previews?

Without any configuration, the default action when clicking on a browser icon in PhpStorm/WebStorm is to open the file in localhost:port.
Is there a way to get PhpStorm to use a custom domain? (Let's assume the domain is already setup to point to 127.0.0.1 in your /etc/hosts file.)
You may want to configure deployment (Build, Execution, Deployment | Deployment) and specify "Web Server URL" there. In this case, "Open in browser" action will refer to this setting instead of built-in server.
More about deployment:
https://www.jetbrains.com/help/phpstorm/settings-deployment.html
Sure, just define deployment entry and mark it as Default for this project. It will now be used instead of PhpStorm's built-in simple webserver.
Settings/Preferences | Build, Execution, Deployment | Deployment
URL from Web server root URL field will be used instead of localhost:63342.

WebSphere Liberty + Intellij Idea - JSP reload on fly

Can someone please answer, how to configure WebSphere Liberty under Intellij Idea to reload JSPs files by Ctrl + F10?
Currently classes are reloaded, but JSPs and resources not.
As far as I know, under Tomcat all is reloaded without extra configurations..
Now in my Idea Liberty server configuration are choosen following:
1. Under Deployment Tab: WAR exploaded (or EAR - no matter)
2. Under Server Tab: On frame deactivation and Update action: Update Classes And Resources
In server.xml are selected following features
<feature>webProfile-6.0</feature>
<feature>localConnector-1.0</feature>
<feature>jaxws-2.2</feature>
<feature>jaxb-2.2</feature>
<feature>jaxrs-1.1</feature>
<feature>ejbLite-3.1</feature>
<feature>cdi-1.0</feature>
<feature>appSecurity-2.0</feature>
<feature>jsp-2.2</feature>
<feature>servlet-3.0</feature>
As server is used WebSphere Liberty Profile 7-8.5.5.7 version
Thank you in advance.
In WebSphere Liberty, updating a JSP in an application does not trigger a server/application to refresh / reload similar to what servlet or class file does. The reload of the JSP occurs internally in the JSP Engine only when that particular JSP file is requested. It is then, it will check the timestamp of the JSP against the previously compiled .class file to see if they do not match and trigger a re-translate and re-compile. That is part of the JSP request lifecycle, therefore there is no sense doing anything on the server until that JSP is requested.
Thanks Jay for pointing me into correct direction.
It turns out that IntelliJ Idea correctly updates resources both with JSPs in corresponding modules by Ctrl+F10.
Liberty Server actually caches JSPs in its own folder, and does not even goes back to check if JSP has changed. On my machine on Windows this folder was under following path:
%YOUR_LIBERTY_SERVER_PATH%\workarea\org.eclipse.osgi\138\data\temp\default_node\SMF_WebContainer\%YOUR_EAR(WAR)_NAME%\jsp
My example Liberty Server path:
..\IBM\wlp-javaee7-8.5.5.7\wlp\usr\servers\defaultServer
It looks like the path may differ. So just look for some JSP name which was already accessed, under following folder:
%YOUR_LIBERTY_SERVER_PATH%\workarea
When found, remove 'jsp' folder, and enjoy =) Liberty goes back for fresh JSP.
If somebody knows, how to configure Liberty to always check for JSPs in corresponding module, please let me/us know.
Thank you.

IntelliJ project local deployment configuration for Tomcat- local server root URL

I'm trying to get a local Tomcat deployment under control in IntelliJ (version 12) and so looking to configure a local connection to Tomcat.
I try to add a server specifying 'Local or mounted folder'. All seems okay but asks me to specify 'web server root URL'.
As its a local server I'd like something like '/opt/tomcat/tomcat7-dev' which points to the root of my tomcat install, however IntelliJ logically says this 'URL is not valid'.
Any advice on correct way to specify local server for IntelliJ deployment?
Local Tomcat configuration doesn't require any Deployment settings or mappings, you just configure a server, artifact and a run configuration to start the server and deploy the artifact, more details can be found in the tutorial.

Implementing a JAAS page to a WAR file on JBOSS AS 7.1.1

I'm very new to web applications. I've been told that JBOSS 7.1.1 has an in-built JAAS system which can be enabled on my JBOSS configuration quite simply. However I'm having trouble trying to get this running, namely most internet searching I went through has just ended up with older versions of JBoss.
Does anyone have a step-by-step guide on how to implement a simple JAAS authentication screen on my WAR file in JBoss 7.1.1? Prefarbly using its h2 database. Thanks :)
Also - my machine has trouble with Eclipse, so I can't use any of Eclipse EE's nifty server running mechanisms.
Finally got it. For those of you in the future:
You need your own standard login/logout pages in jsp/html/whatever. You put that in your web.xml constraints. Then you add an xml file called "Jboss-web" and type in your security domain (the default AS 7 is called 'other'). Then lastly add users and roles using adduser.bat in config folder.

Deploy War into Mule Standalone server

I've got a mule-standalone server with an application I'm working on. Many of the services this application uses will be moved out of the Mule container into a JBoss cluster in the future. Because of this, I'm keeping a strong separation between the mule flows, and the Web Services. However, as of right now, I need to deploy the War file on the same server as my Mule application.
It seems like Mule should be able to run my War within it. Does anyone know if this is possible? I'm OK with adding a War into the Mule deployable zip for the time being, but would also like to deploy the war separately.
Mule ESB is not a standard Java EE container so it won't be hable to handle directly WAR files. In fact mule applications have the following structure:
/
\- classes // application-specific resources(e.g. logging config, properties)
|- lib // application-specific jars
|- mule-config.xml // Main Mule configuration file, also monitored for changes
|- mule-deploy.properties // Application deployment descriptor (optional)
|- mule-app.properties // custom properties to be added to the registry instance used by the application (optional)
as better explained here:
http://www.mulesoft.org/documentation/display/MULE3USER/Application+Format
What you can do is leverage the mule jetty connector to expose your web application. Your connector configuration will look like the following:
<jetty:connector name="jettyConnector">
<jetty:webapps directory="${app.home}/webapps" port="8083"/>
</jetty:connector>
and you will be putting your war files into the webapps folder. You can use the bookstore example as a reference:
http://www.mulesoft.org/documentation/display/MULE3EXAMPLES/Bookstore+Example