How to modify EAR sources on the fly in Wildfly? - wildfly

I'm using Wildfly 10. Is there any way to structure my standalone.xml configuration file such that during development, I can deploy an EAR (exploded or not) but have Wildfly point to my static resources directly in my development path?
For instance, if I have an EAR that contains a WAR with the following:
EAR
|- EJB module
|- Web module
\- index.html
\- js/general.js
\- *.jsp
\- WEB-INF
\- libs
\- classes
I'm looking for a configuration that would allow me to setup my dev machine such that I can modify my *.js, *.html, *.jsp files directly from my development path, and not in the exploded WAR directory. So basically, I would like to point Wildfly to use all the non-compiled files in my c:\dev\project\web folder instead.
Is this at all feasible? If not, what is the closest I can get to this?
I've tried updating the undertow subsystem to the following but to no avail:
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" socket-binding="ajp"/>
<http-listener name="default" max-parameters="2000" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/webapp/" handler="web-files"/>
</host>
</server>
<servlet-container name="default" disable-caching-for-secured-pages="false">
<jsp-config recompile-on-fail="true" modification-test-interval="1" check-interval="1" development="true"/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
<file name="web-files" path="C:/dev/Projects/projectweb/src/main/webapp"/>
</handlers>
<filters>
where my application.xml specifies my war as a context path of /webapp.
How else can I structure my development setup to allow modification of my files on the fly?

JBoss Tools, Idea or NetBeans allows you do to that automatically for 'static' content, for classes it would do it also but it will trigger a redeployments to be 'sure' that the new classes are taken into account.

Related

How to configuration of datasource in war instead of standalone.xml

I have working on datasource in wildfly jboss server configuration I want to configure datasource in application that is inside war file, please help me with this thanks.
It's possible to deploy a *-ds.xml file with your data source definition. Nevertheless, this way of DS definition is not recommended!
The format looks like:
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjaca
mar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/GreeterQuickstartDS"
pool-name="greeter-quickstart" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
You can put the *-ds.xml files directly into the standalone/deployments directory or call JBoss CLI deploy command:
deploy /path/to/your-custom-ds.xml
You can also put the *-ds.xml file into the WEB-INF directory directly in your web application.
$ unzip -l target/greeter.war |grep ds.xml
684 2019-11-10 18:53 WEB-INF/greater-ds.xml

JBOSS 7.2.2 External Folder Linking

I have been searching around for this specific problem of mine. We have a folder that is on a shared folder on another server "\\server1\shares\web\images" and I want to link this folder into my web application in Jboss 7.2.2. I'm migrating from Jboss 4.2.2 to Jboss 7.2.2.
Here is my server.xml file from Jboss 4.2.2. You'll notice that the <Context> tag handles this link for me.
<Server>
<Service name="jboss.web">
<!-- ... -->
<Engine name="jboss.web" defaultHost="localhost">
<!-- ... -->
<Host name="myApp" autoDeploy="false" deployOnStartup="false"
deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
<!-- ... -->
<Context path="/images" appBase="" docBase="\\server1\shares\web\images"
debug="99" reloadable="true" />
<!-- ... -->
</Host>
</Engine>
</Service>
My research has lead me to use modules, but I cannot figure out how to use the modules properly for this problem. Most examples shows how to provide some link to a folder on the same machine as the Jboss server is on.
So, am I suppose to use modules or is there another way of doing this?

Create a global filter in JBoss 7

I want to create a global custom filter, that catches(for checking/modification etc) http-headers for all web-applications on server.
I tryied to apply my filter as a global-module in standalone.xml, but it doesn't work
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<global-modules>
<module name="com.myfilter.filter" slot="main"/>
</global-modules>
</subsystem>
Help me please!
Global module will only add something to global class path, it will not use it for requests.
What you request is outside Java EE specification. Some servers support such a functionality as an extension to the spec. Tomcat and JBoss have such extended support using Valves. You should be able to do what you're after by implementing a Tomcat Valve, installing it as a module and then configuring it to JBoss like instructed here:
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
<valve name="myvalve" module="org.jboss.web-valves" class-name="org.apache.catalina.valves.AccessLogValve">
<param param-name="prefix" param-value="catalina_access_log."/>
<param param-name="suffix" param-value=".txt"/>
</valve>
. . . .
</subsystem>

Have added Ivy management to Eclipse project, then what?

Have added Ivy management to one of my eclipse projects. Nothing happened after that.
I have a guide to add something to ivy.xml and ivysettings.xml, so what? How to create empty versions of these files? Where to put them?
I have created some by intuition, in the project root, then added to files what was told.
Nothing happened. Where are new libraries? How to force Ivy to do something?
Versions:
Apache IvyDE 2.2.0.beta1-201203282058-RELEASE
Eclipse Helios Service Release 2
Guides for ivy are for xuggler: http://www.xuggle.com/downloads
I have created ivy.xml by File New and added what was said without ellipsis. icysettings.xml are just the sample w/o ellipsis.
Yes ivy.xml should be in the root (for default configuration).
try this:
<ivy-module
version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="com.organisation" module="stackoverflow" revision="1.0.0" status="integration" >
</info>
<configurations>
<conf name="default" />
</configurations>
<dependencies>
<dependency org="xuggle" name="xuggle-xuggler" rev="5.2" />
</dependencies>
</ivy-module>
Create ivysettings.xml file in the root as well. This one is adapted to your need
<ivysettings> <
settings defaultResolver="default" />
<include url="${ivy.default.settings.dir}/ivysettings.xml" />
<resolvers>
<url m2compatible="true" name="xugglecode">
<ivy
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organization]/[artifact]/[revision]/ivy-[revision].xml" />
<ivy
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organization]/[artifact]/ivy-[revision].xml" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[artifact](-[revision]).[ext]" />
<artifact
pattern="http://build.xuggle.com/view/Stable/job/red5_jdk6_stable/lastSuccessfulBuild/artifact/workingcopy/dist/[artifact].[ext]" />
</url>
<chain name="default" changingPattern=".*SNAPSHOT">
<resolver ref="xugglecode" />
</chain>
</resolvers>
</ivysettings>
Now when you add ivy management, in Main tab you should see Ivy File: ivy.xml as default.
now go to settings tab. Check the box of 'Enable project specific settings'.
in Ivy settings path, easier to choose the one you just created in your root project using 'Workspace button'. Navigate and choose.
Press ok. It will start resolving immediately.
I should tell you, that even though the file exists, I couldn't retrieve it. The ivy- console seems stuck. I'm receiving Status Code 403. I'm doing from work.
Maybe you have better luck resolving it. If not, consider this as a mini example of how to set up IvyDE.

JBoss (liferay) no context.xml so where to put JNDI resource

I've got the order to switch from Liferay on tomcat, to Liferay on JBoss.
One issue I'm having is that unlike in tomcat, I can't seem to find a context.xml in liferay-portal-6.0.5\jboss-5.1.0\server\default\conf
Will it work if I just copy the context.xml from my tomcat installation to my jboss installation? (I don't know if JBoss scans that folder).
Or is there an alternative location where I can put my resource?
<Resource name="jdbc/x" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="y"
username="z" password="A" maxActive="20" maxIdle="10"
maxWait="-1"/>
Add a file named "*- ds.xml" in the deploy directory server with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/myds</jndi-name>
<connection-url>jdbc:oracle:thin:#127.0.0.1:1521:sid</connection-url>
<user-name></user-name>
<password></password>
<new-connection-sql>SELECT * FROM DUAL</new-connection-sql>
<check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</local-tx-datasource>
</datasources>