Archive for the ‘en-US’ Category
(long tweet) How to display / modify Oracle XDB port?
Oracle XDB port runs by default on port 8080… which is quite an issue for Java web developpers, because of the collision with default port used by servlet engines such as Tomcat and Jetty.
To display Oracle XDB port, run:
[sql]select DBMS_XDB.GETHTTPPORT from dual;[/sql]
To change it (for instance to set it on port 9090), run
[sql]exec DBMS_XDB.SETHTTPPORT(9090);[/sql]
(long tweet) Could not find backup for factory javax.faces.context.FacesContextFactory.
Case
On deploying a JSF 2.2 / Primefaces 5 application on Jetty 9, I got the following error:
[java]java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.[/java]
The issue seems linked to Jetty, since I could not reproduce the issue on Tomcat 8.
Quickfix
In the web.xml
, add the following block:
[xml] <listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>[/xml]
MultiException[java.lang.RuntimeException: Error scanning file]
Case
I run a project with JSF 2 / PrimeFaces 5 (BTW: it rocks!) / Spring 4 / Jetty 9 / Java 8:
[java]MultiException java.lang.RuntimeException: Error scanning file SummerBean.class, java.lang.RuntimeException: Error scanning entry …/SummerService.class from jar file:/…/spring-tier-1.0-SNAPSHOT.jar, java.lang.RuntimeException: Error scanning entry …/SummerServiceImpl.class from jar file:/…/spring-tier-1.0-SNAPSHOT.jar
at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:530)[/java]
Explanation
The error occurs because of a conflict on the JARs of ASM.
Fix
You have to override Jetty’s dependencies to ASM.
In Maven’s POM, amend Jetty plugin to force ASM versions:
[xml]<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>5.0.2</version>
</dependency>
</dependencies>
<!– … –>
</plugin>
[/xml]
Then it should work 😉
SizeLimitExceededException: the request was rejected because its size (…) exceeds the configured maximum
Stacktrace
On deploying a WAR in Tomcat:
[java]org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (128938160) exceeds the configured maximum (52428800)[/java]
Quick fix
Edit the file $CATALINA_HOME/webapps/manager/WEB-INF/web.xml
Replace the block
[xml] <multipart-config>
<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config> [/xml]
with:
[xml] <multipart-config>
<!– 200 MB max –>
<max-file-size>209715200</max-file-size>
<max-request-size>209715200</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
[/xml]
Mount a shared drive with VirtualBox
Case
You have to share some content between the host (eg: Linux Mint) and the resident (eg: Windows 7) systems, with Virtual Box.
Solution
- In the resident system, go to Virtual Box, then:
Machine
>Settings
> SharedFolders
> on the right:Add
> checkautomount
andpermanent
, browse to the folder, let’s sayD:\sharedFolder
- Launch the VM.
- Execute a terminal in host system:
- Grant rights of group
vboxsf
to usermint
:
sudo gpasswd -a mint vboxsf
- Create a “local” folder:
mkdir ~/sharedFolder
- Mount the folder
sharedFolder
on/home/
:
sudo mount -t vboxsf -o uid=1000,gid=1000 sharedFolder ~/sharedFolder
(long tweet) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘type=InnoDB’ at line 1
Stacktrace
[java]org.hibernate.tool.hbm2ddl.SchemaExport – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘type=InnoDB’ at line 1[/java]
Quick fix
In JPA configuration, replace:
datasource.dialect = org.hibernate.dialect.MySQLInnoDBDialect
with:
datasource.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
Actually, Java driver for MySQL 5.5+ is not backward compatible with the SQL dialect MySQLInnoDBDialect
.
(long tweet) Run MS-DOS command as super user
How to run a MS-DOS command terminal with administrator priviledges, in Windows 7?
Let’s say you need execute cmd
with the account admin
: launch runas /user:admin cmd
.
Windows will ask you to enter the admin password and then will open a CMD
prompt in admin mode.
“Apache Maven Dependency Management” by Jonathan Lalou, was published by Packt
Abstract
I am glad and proud to announce the publication of “Apache Maven Dependency Management”, by Packt.
Direct link: https://www.packtpub.com/apache-maven-dependency-management/book
Alternate locations: Amazon.com, Amazon.co.uk, Barnes & Noble.
On this occasion, I’d like to thank all Packt team for allowing me achieving this project.
What you will learn from this book
- Learn how to use profiles, POM, parent POM, and modules
- Increase build-speed and decrease archive size
- Set, rationalize, and exclude transitive dependencies
- Optimize your POM and its dependencies
- Migrate projects to Maven including projects with exotic dependencies
In Detail
Managing dependencies in a multi-module project is difficult. In a multi-module project, libraries need to share transitive relations with each other. Maven eliminates this need by reading the project files of dependencies to figure out their inter-relations and other related information. Gaining an understanding of project dependencies will allow you to fully utilize Maven and use it to your advantage.
Aiming to give you a clear understanding of Maven’s functionality, this book focuses on specific case studies that shed light on highly useful Maven features which are often disregarded. The content of this book will help you to replace homebrew processes with more automated solutions.
This practical guide focuses on the variety of problems and issues which occur during the conception and development phase, with the aim of making dependency management as effortless and painless as possible. Throughout the course of this book, you will learn how to migrate from non-Maven projects to Maven, learn Maven best practices, and how to simplify the management of multiple projects. The book emphasizes the importance of projects as well as identifying and fixing potential conflicts before they become issues. The later sections of the book introduce you to the methods that you can use to increase your team’s productivity. This book is the perfect guide to help make you into a proud software craftsman.
Approach
An easy-to-follow, tutorial-based guide with chapters progressing from basic to advanced dependency management.
Who this book is for
If you are working with Java or Java EE projects and you want to take advantage of Maven dependency management, then this book is ideal for you. This book is also particularly useful if you are a developer or an architect. You should be well versed with Maven and its basic functionalities if you wish to get the most out of this book.
Table of content
- Preface
- Chapter 1: Basic Dependency Management
- Chapter 2: Dependency Mechanism and Scopes
- Chapter 3: Dependency Designation (advanced)
- Chapter 4: Migration of Dependencies to Apache Maven
- Chapter 5: Tools within Your IDE
- Chapter 6: Release and Distribute
- Appendix: Useful Public Repositories
- Index
How to compile both Java classes and Groovy scripts with Maven?
Case
Your project includes both Java classes and Groovy scripts. You would like to build all of them at the same time with Maven: this must be possible, because, after all, Groovy scripts are run on a Java Virtual Machine.
Solution
In your pom.xml
, configure the maven-compiler-plugin
as follows:
[xml] <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>1.6</source>
<target>1.6</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.5-03</version>
</dependency>
</dependencies>
</plugin>[/xml]
With such setup, default compiler (which cannot compile Groovy scripts parallelly of Java sources) will be replaced with Eclipse’s one (which can).
How to know which versions of Xerces and Xalan are run in the JDK?
Run this command:
[java]java com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck[/java]