Recent Posts
Archives

PostHeaderIcon Change settings.xml location

Case

You have to use a custom-set settings.xml file, rather the default one.

By default, settings.xml is assumed to be in one the two following folders:

$M2_HOME/conf/settings.xml
$HOME/.m2/settings.xml

Fix

Use the -s option, for instance:

mvn install -s /path/to/file/otherSettings.xml

PostHeaderIcon WebLogic 10.x new features

Recent history

BEA WebLogic 9.0, 9.1 and 9.2 were released from 2007: the main features were: a new console, WLST (WebLogic ScriptingTool), deployment plans, WebLogic Diagnostic Framework (WLDF), new security providers (RDBMS, SAML 1.1, etc.), JMS performance improvements, support of Java EE 4, JDK 5, Spring, OpenJPA, Kodo, etc.

Since this date, some events happened:

  • Oracle bought Sun (2009)
  • Oracle released WebLogic 10.3 (2008)
  • Oracle bought BEA (2008)

WebLogic Server 10 General Features

  • Developer productivity ehancements
    • JDK 6, Java EE 5
    • Support of EJB3 and JPA
    • BEA enhancements
  • Web Services: more annotations, less XML
    • JAX-RPC Web Services Enhancements
    • JAX-WS 2.0 Web Services Implementation
  • Misc:
    • Better administration console
    • Auto-Record of Admin Console actions as WLST scripts
    • Automatic JTA Transaction Recovery Service (TRS) migration
    • SNMP 3.0
    • Production Application Redeployment enhancements
    • Clustering – Unicast messaging (in addition to Multicast)

Programmer Perspective

  • New persistence engine: TopLink
  • OEPE (Oracle Entreprise Pack for Eclipse): sequence of tools and plugins for Eclipse: remote deployment, debugging,  editors for weblogic.xml and weblogic-application.xml, wizards, facets, Weblogic ClientGen, WSDLC and JAXB wizards
  • Optimizations for Spring integration and certication
  • Web 2.0:
    • Ajax / Dojo client support
    • Http publish / submit engine for collaborative applications:
      • Bayeux protocol
      • data exchange within applications over persistent connections
      • scalability for Dojo clients
  • Ad-hoc tools for:
    • Oracle Database
    • Spring
    • JAX-WS webservices

Lightweight WebLogic Server

WebLogic 10 offers a light weight server:

  • Install only “core” WebLogic server
  • Optionally, startup other services (JDBC, EJB, JMS, etc.)
  • FastSwap: modify classes without requiring redeployment.

Architect Perspective

Architects have to consider WebLogic as a complete suite, and not only WebLogic Server:

  • Oracle RAC integration: Connectivity to RAC with load balancing, failover, transactions
  • Enterprise Messaging with JMS: High performance and reliable JMS messaging engine “built-in”
  • ActiveCache with Coherence*Web and EJB/JPA: Coherence Data Grid caching included and integrated
  • Operations Automation: Tools for automating management of applications and servers
  • Operations Insight: Tools for diagnosing problems in development and production
  • Other features
    • Development tools: Choice of tools for developer productivity
    • Web Services: Enterprise Web Services for SOA
    • TopLink: Persist application data to stores with performance and productivity. It works in a way similar to Hibernate L2 cache.
    • Spring: Enable flexible choice of dev frameworks with same WebLogic QOS

Production and Support Perspective

WebLogic 10 provides a tool: JRockit Mission Control

  • monitors more than 150 parameters:
  • CPU
    • memory
    • leaks
    • latency spikes
    • threads
    • object references
    • JDBC connections
    • JMS
    • pools
    • clusters
    • configuration files
    • etc.
  • allows to compare WebLogic domains
  • Runtime Analyzer: runtime capture for offline analysis, Garbage Collector analysis, etc.

Coherence – ActiveCache

Coherence is the Data Grid offered by Oracle. It allows to store Java objects in memory, and share them between all instances. From a certain viewpoint, Coherence looks like the GigaSpaces.

Roadmap for Future WebLogic Releases

  • Support of Java EE 6 (ratified by the community in last December)
  • OSGi deployment
  • More native integration for WebLogic Server – Coherence – Oracle Database
  • JRockit Flight Recorder for constant record
  • Virtualization
  • More integration with Maven, Hudson and Cruise Control
  • Shared Library: use the same JAR for many applications, rather than packing the same JAR in different EARs.
  • On long term:
    • IDE
      • NetBeans to be oriented onto J2ME development
      • JDevelopper to remain Oracle strategic IDE
      • Contributions to Eclipse to go on
    • JRockit and Sun HotSpot JVMs to be merged.

PostHeaderIcon Operand type clash: java.util.Date is incompatible with DATETIME

Case

With Mule ESB, I try to integrate an object of type java.util.Date into a column of type datetime in a Sybase DB table.
I get the following error:
[java] java.sql.SQLException: Operand type clash: java.util.Date is incompatible with DATETIME[/java]

Explanation – Fix

The stacktrace is explicit: java.util.Dates are not compatible with Sybase datetime, as Java’s Strings are not compatible with Sybase numeric(10, 3) for instance.
To fix the issue, you have to cast your java.util.Date as java.sql.Date or java.sql.Timestamp. The cast is very easy to perform:
[java]private static java.sql.Timestamp javaDate2SqlTimestamp(java.util.Date javaDate){
final java.sql.Timestamp answer = new java.sql.Timestamp(javaDate.getTime());
return answer;
}[/java]

The method is quite similar for java.sql.Dates cast.

PostHeaderIcon weblogic.management.internal.InteractiveConfigurationException

Case

You have to create a Weblogic 9.2 domain. When you launch the admin application, Weblogic tries to retrieve a wrong config.xml, in a location that you did not hint. Then, Weblogic suggests to create such config.xml

Short stacktrace

[java]No config.xml was found.
Would you like the server to create a default configuration and boot? (y/n): n
<Feb 9, 2010 4:49:56 PM CET> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason:

There are 1 nested errors:

weblogic.management.internal.InteractiveConfigurationException: \wrong\path\config.xml not found.
If you wish to have the server generate a default configuration file and boot, please re-execute your start command and respond to prompts or pass additional parameter of -Dweblogic.management.GenerateDefaultConfig[/java]

Fix

In your start scripts and $WL_HOME/bin/setDomainEnv.cmd, check your settings, among which all the occurences of DOMAIN_HOME. Another important parameter to check is LONG_DOMAIN_HOME.

PostHeaderIcon Cannot run this command because Java services are not enabled. A user with System Administrator (SA) role must reconfigure the system to enable Java.

Context

An object is marshallized and sent on TibcoRV 8.1. An instance of Mule ESB 2.2.1 listens to TibcoRV, reads the message, unmarshalls the object and builds an SQL insert query.

The query is very simple:

[sql]insert into myTable(dateColumn, stringColumn) values(…)[/sql]

It is executed in a Jdbc connector declared on Mule configuration file:

[xml] <jdbc:connector name="jdbcConnector" dataSource-ref="mySybaseDB" pollingFrequency="1000">
<jdbc:query key="writeTest"
value="INSERT INTO myTable(dateColumn, stringColumn)
VALUES(#[map-payload:myJavaDate],#[map-payload:myJavaString])"/>
</jdbc:connector>[/xml]

The DB is Sybase. The first column is of type datetime, the second one is varchar. The values are retrieved from a java.util.Date and a java.lang.String.

Case

When the query is run, I get the error:

[java]java.sql.SQLException: Cannot run this command because Java services are not enabled. A user with System Administrator (SA) role must reconfigure the system to enable Java.[/java]

(you may get a com.sybase.jdbc2.jdbc.SybSQLException instead of java.sql.SQLException)

Explanation – Fix

The error is related only to Sybase, and not to TibcoRV and Mule: by default, Sybase cannot manage Java Dates (java.util.Date). You have to start explicitly the Java services. To perform that:

  • login with an username owing the rights “sa_role
  • run the SQL query: [sql]sp_configure ‘enable java’, 1[/sql]
  • the restart the Sybase server

Now it should work. A similar error may occur with JBoss.

PostHeaderIcon Display the Unix server name of a Sybase DB

  • Let’s consider a Sybase server on which you are logged.
  • You need know the Unix server name.
  • Launch the SQL query:

select @@servername

PostHeaderIcon SVN repository location change

Case

Your project repository was hosted by a server oldServer. A morning, you come at office, nothing works, impossible to update your project.

After hours searching for an explanation, you happen to know that your dear colleagues off-shore moved the repository onto another location, let’s say newServer.

Now you have to relocate your project on your local desktop.

Fix

Use the following command on your project head folder:

svn switch --relocate svn://oldRepository svn://newRepository

This operation may be performed with TortoiseSVN (right click on the directory > TortoiseSVN > Relocate)

PostHeaderIcon svn: OPTIONS request failed on

Case

IntelliJ IDEA 7.x, version control with Subversion.
When I try to update the project, I get the following error:

Error:svn: unknown host myHost svn: OPTIONS request failed on /myProject/trunk/

On another hand, I can update the project thanks to TortoiseSVN. Then, I conclude the server exists and allows updates.

Fix

Firstly I thought of an issue of proxy, hence check your settings if you face the problem. Else:

  • Shutdown IDEA
  • Delete ~/.IntelliJIdea70/system/caches
  • Restart IDEA

PostHeaderIcon [EJB:011055]Error deploying the EJB

Case

On redeploying the application myFooApplication, this error appears:

[EJB:011055]Error deploying the EJB 'myFooSession(Application: foo-ejbfoo-ear, EJBComponent: foo-foo-services-ejb-0-DEV.jar)', the JNDI name 'ejb.foo.foo-session-bean' is already in use. You must set a different JNDI name in the weblogic-ejb-jar.xml deployment descriptor for this EJB before it can be deployed.

Fix

  • Stop the server
  • Delete all files and folders in ${WL_HOME}\servers\myFooApplication.
  • Restart the server

You may encounter an error [Deployer:149163]. In this case, I suggest you to consult the related article: The domain edit lock is owned by another session in exclusive mode – hence this deployment operation cannot proceed

PostHeaderIcon Remote debug on Mule 2.2.1

Case

You have to run a standalone Mule 2.2.1 in debug mode. Since Mule is launched in standalone, you have to debug a remote application.

Fix

Nice case

  • Edit the %MULE_HOME%/conf/wrapper.conf
  • Uncomment the line:
    wrapper.java.additional.<n>=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
  • Don’t forget to set the parameter <n>

Boring case

In my case (Windows XP SP2, Java 1.5), the Mule refused to start and freezed:

------------------------------------------------------------------------
The JVM is being launched with a debugger enabled and could possibly be
suspended.  To avoid unwanted shutdowns, timeouts will be disabled,
removing the ability to detect and restart frozen JVMs.
------------------------------------------------------------------------
Launching a JVM...
Listening for transport dt_socket at address: 5005
------------------------------------------------------------------------
Startup: Timed out waiting for a signal from the JVM.
The JVM was launched with debug options so this may be because the JVM
is currently suspended by a debugger.  Any future timeouts during this
JVM invocation will be silently ignored.
------------------------------------------------------------------------

The fix this:

  • Download the jar spring-agent here.
  • Move it into %MULE_HOME%/lib/user/
  • Edit the %MULE_HOME%/conf/wrapper.conf
  • add the following block:
  • wrapper.java.additional.3=-javaagent:%MULE_HOME%\lib\user\spring-agent-2.5.3.jar
    wrapper.java.additional.4=-Xdebug
    wrapper.java.additional.5=-Xnoagent
    wrapper.java.additional.6=-Djava.compiler=NONE
    wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
  • (by the way, even though properties #3 and #5 are inconsistent, don’t mind)
  • launch the Mule
  • In your IDE (Eclipse, NetBeans, IntelliJ IDEA), run debug on localhost:5005