I have the following rebel.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<dir name="${project.dir}/src/main/resources"/>
<!-- Useful for classes when IDE auto compile on save is enabled, classes will be redeployed -->
<dir name="${project.dir}/target/classes"/>
<dir name="${project.dir}/target/digital-entitlement/WEB-INF/classes"/>
</classpath>
<!-- <web> -->
<!-- <link target="/"> -->
<!-- <dir name="${project.dir}/src/main/webapp"/> -->
<!-- </link> -->
<!-- </web> -->
</application>
with it class reloading is working fine.
But when I uncomment the <web> fragment above, to enable web assets reloading, then the web app hangs on a login form test case:
w/o the <web> config the web page is loaded correctly and then submitting the un/pwd is ok triggering the reload of server side classes by jrebel when modified.
Adding the <web> config hangs the browser and the initial login page is never loaded (selenium tests go in timeout after 30 secs).
NOTE: not all the web pages hang when the <web> config is enabled.
Thanks
Related
title says it all. How do I setup a log4j2 configuration in my Open-liberty project? I've added my log4j2.xml file in the resources folder and I use the following dependency in my pom.xml:
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
This is my server.xml:
<server description="Intake Server">
<featureManager>
<feature>servlet-4.0</feature>
<feature>mpConfig-1.4</feature>
<feature>cdi-2.0</feature>
</featureManager>
<variable name="default.http.port" defaultValue="9080"/>
<variable name="default.https.port" defaultValue="9443"/>
<variable name="app.context.root" defaultValue="message"/>
<httpEndpoint httpPort="${default.http.port}"
httpsPort="${default.https.port}" id="defaultHttpEndpoint" host="*" />
<library id="log4jConfig">
<folder dir="/var/log/intake" scanInterval="5s" />
</library>
<webApplication id="intake" location="intake.war" contextRoot="${app.context.root}">
<classloader commonLibraryRef="log4jConfig"/>
</webApplication>
</server>
You'll also need to add log4j to the classpath, and there's several ways you can do that (with pros/cons to each, but I would suggest #2, unless you have more then one app that's going to be making use of log4j, in which case 3 may be the better approach):
Package it with your app (inside the war)
Add it in the server.xml via the classloader attribute under your webApplication
Drop it in the global shared library folder: ${shared.config.dir}/lib/global or ${server.config.dir}/lib/global
Set it via JVM argument: -Dlog4j.configurationFile=file:/path/to/log4j2.xml
I'll mention that there is also an archived repo regarding using log4j with Open Liberty that you may find helpful, but keep in mind that it is archived so it's likely incomplete and with no dev support.
I'm working on a Spring Multi Module Project.
One of the projects contains some JSON file in a folder called drivers, located
in: <Project>/src/main/resources.
When I first launch the app all the JSON files are correctly loaded, but if I make a change to one of them JRebel keeps on using the old one.
Is there a way to configure it to solve this issue?
Thank you.
Here is the rebel.xml for this project:
<?xml version="1.0" encoding="UTF-8"?>
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="C:/PathToProject/target/classes">
</dir>
<dir name="C:/PathToProject/src/main/resources/drivers">
</dir>
</classpath>
<web>
<link target="/">
<dir name="C:/PathToProject/src/main/webapp">
</dir>
</link>
</web>
</application>
Change the classpath part to
<classpath>
<dir name="C:/PathToProject/src/main/resources/"/>
<dir name="C:/PathToProject/target/classes"/>
</classpath>
If the application is trying to load a classpath resource, its full name is important(e.g. drivers/myfile.json) as this is what is passed to the classloader. The rebel.xml must specify paths that are classpath roots, not subfolders. For finer control you can use includes/excludes for the dir entry.
Also the paths are checked in order and if it exists in the first one, that is returned even if it's older.
So in your current configuration JRebel would first search for
C:/PathToProject/target/classes/drivers/myfile.json and find the old version there from the last run of maven-resources-plugin copy-resources goal or project build in IDE.
Now if only the order was fixed, the second path is still incorrect as it would look for C:/PathToProject/src/main/resources/drivers/drivers/myfile.json where it doesn't exist.
I'm using Vaadin 7.6.3 with Spring Boot. I'm trying to use the PopupButton add-on (but I don't think the issue is specific to the add-on).
I added the add-on as a dependency to gradle. This is the code for creating a PopupButton:
PopupButton btn = new PopupButton("Test Button");
btn.setContent(new Label("Test"));
layout.addComponent(btn);
Via the Vaadin plugin for Gradle I ran the task vaadinCompile which created the file src/main/resources/addon/client/ListaideWidgetset.gwt.xml and serveral files in src/main/webapp/VAADIN/gwt-unitCache and
src/main/webapp/VAADIN/widgetsets/addon.client.ListaideWidgetset. I also added #Widgetset("addon.client.ListaideWidgetset") to my UI. I confirmed that the widgetset is used via the client's ?debug mode.
Content of ListaideWidgetset.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
<source path="client" />
<source path="shared" />
<collapse-all-properties />
<set-property name="compiler.useSymbolMaps" value="true" />
</module>
The problem is that on the client the button shows up as a standard button (no chevron) and doesn't open a popup when clicked.
Your widgetset does not contain the addon. See the the example:
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset" />
Once added, recompile the widgetset, restart your application.
Usually the gradle plugin can handle this for you, but that feature can be disabled and or some other configuration error could prevent it. Hard to tell without the build.gradle...
edit
The gradle vaadin plugin seems not to be able to handle this addon properly. As a workaround disable the automatic management for widgetset, which prevents regeneration of the gwt.xml. See manageWidgetset in https://github.com/johndevs/gradle-vaadin-plugin/wiki/Tasks-and-configuration-DSL). E.g. add vaadinCompile.manageWidgetset = false in your vaadin{}-block.
I have a modular web project and thus I am allowing modules to be a war archive including webapp folder. Using the following rebel.xml works fine on detecting class changes over all modules. But for some reason jrebel does not move when a html or js is changed.
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<!-- appserver -->
<dir name="/home/xx/data/appserver/target/classes/main"/>
<dir name="/home/xx/data/appserver/target/resources/main"/>
<!-- module -->
<dir name="/home/xx/data/as.module.core/target/classes/main"/>
<dir name="/home/xx/data/as.module.core/target/resources/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/classes/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/resources/main"/>
</classpath>
<!-- web>
<link target="/">
<dir name="/home/xx/data/appserver/src/main/webapp"/>
<dir name="/home/xx/data/as.module.core/src/main/webapp"/>
<dir name="/home/xx/data/as.module.mqlcore/src/main/webapp"/>
</link>
</web -->
<web>
<link target="/">
<dirset dir="/home/xx/data">
<include name="**/src/main/webapp"/>
</dirset>
</link>
</web>
</application>
EDIT:
Interesting fact is. When I use the commented part of web configuration all three webapp folders are in the log and will be monitored for changes. But the application server can not find all of the webapp files. When I use the second <web> configuration all files are seen by the application server but are not observed by jrebel. I think it is not possible to have multiple directories linked to "/"
Each of the modules eg .war or .jar files need to have their own rebel.xml files. Otherwise all of them will reload same resources and when having different classloaders all kind of weird things can happen.
It is possible to check which instance of the file JRebel actually uses by searching "found resource" from jrebel.log. It should be written something like this
sun.misc.Launcher$AppClassLoader#184be29 found resource: 'cfg/log4j.xml' from 'file:/C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'.
It is also seen which of the file changed by loking up lines with Event like this:
[IntelliJFSNotify] Event 'CHANGE' on: 'C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'
Usually found resource and changed file paths do not match if the file is not reloaded. If they do match then it is recommended to send absolute path of the file and jrebel.log to support#zeroturnaround.com for investigation.
Ok, the answer is: indeed it is not possible to configure more than one directory under the <web><link target="/"></link></web> configuration. I have now a folder ./target/all-webapp where I smylink (cp -sR) all files via gradle task ... not nice but works ... and thank god jrebel is following symlinks!
My GWT app, using UiBinder, won't load in Internet Explorer. However, it loads just fine in Firefox, Safari, and on the iPhone.
In trying to isolate the problem, I've been stripping out parts trying to find the root cause. I'm down to basically a Label and it still works in FF but not IE.
Here's the EntryPoint:
public class Core implements EntryPoint {
private static Core instance;
public static Core instance() {
return instance;
}
#Override
public void onModuleLoad() {
instance = this;
RootPanel container = RootPanel.get("container");
container.add(new Label("hi"));
}
}
Here's my index.jsp:
<!doctype html>
<html>
<head>
<script type="text/javascript" src="core/core.nocache.js"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
Here's my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>realAppNameHere</application>
<version>andrew</version>
<static-files>
<include path="**" />
<!-- The following line requires App Engine 1.3.2 SDK -->
<include path="**.nocache.*" expiration="0s" />
<include path="**.cache.*" expiration="365d" />
<exclude path="**.gwt.rpc" />
</static-files>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
And here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Even with this stripped-down version of everything, it still works in Firefox but not IE. Now there aren't even any bugs thrown, not even in Firebug... it just doesn't show the label in IE, but it will show the label in FF. I have no idea why this isn't running.
Anyone have any idea?
Edit 3:
Forgot the module.gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='core'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.ajaxloader.AjaxLoader'/>
<inherits name="com.google.gwt.logging.Logging"/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<entry-point class='com.company.core.client.Core'/>
<source path='client'/>
<source path='shared'/>
<set-property name="gwt.logging.logLevel" value="SEVERE"/>
<set-property name="gwt.logging.enabled" value="FALSE"/>
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
</module>
Some of the things won't come up in IE6 but it will definitely get loaded. The first thing you need to see is whether you have added an User agent for IE6 as
<set-property name="user.agent" value="ie6"/>
in your .gwt.xml file.
Next thing you need to check that whether you added an exception for localhost in your browser security settings.
If all this is done and still not working try to cleanup your project and recompile it.
From testing on an actual copy of IE (not the IE plugin for Firefox) we were able to see an error "console is not defined".
Turns out, this was throwing an exception in IE, preventing the page from loading:
public native static void log(String inString)
/*-{
console.log(inString);
}-*/;
So to solve this, we'll take out that reference to console and replace with a cross-browser logging library, such as GWT-Log