Posts Tagged ‘J2EE’
Useful XSD
Following the post on widely used DTDs, here is a list of some XSD (aka XML Schemas):
File | XSD |
---|---|
Maven pom.xml |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
weblogic.xml |
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> |
Maven assembly.xml |
<assembly xmlns="http://maven.apache.org/xsd/1.1.0/assembly" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/xsd/assembly-1.1.2.xsd http://maven.apache.org/xsd/1.1.2/assembly"> |
web.xml |
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> |
EhCache |
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> |
WebLogic: use a startup and/or a shutdown class in a WAR
Abstract
WebLogic offers you to specify a startup and/or a shutdown class for an application. Anyway, this feature is restrained to EARs, and is not available for applications deployed as WARs. For EARs, Oracle WebLogic Server’s documentation is complete and gives basic examples: Programming Application Life Cycle Events
Yet, sometimes you need such a class even for a WebApp. You have two ways to handle this case.
Solutions
Full Weblogic!
Base
The first solution is not elegant. Open WebLogic console, go to Startup And Shutdown Classes
, then add the classes names of which main()
methods will be run on startup and shutdown, let’s say JonathanWeblogicStartup
. These classes must be available in WebLogic classpath, which is surely different from your application classpath, eg in a library $DOMAIN_HOME/lib/customized-weblogic.jar
.
Advantage of this means: if your startup/shutdown class does not evoluate often, then write it once and forget, it will be OK. Unlike, you will have to manage different versions of the JAR on each release… I assume your exploitation team may get angry at playing with classpaths and lib folders 😀
Suggestion
To improve the basic solution (and avoid your exploitation guy burst in your office), I had the following idea, that I did not experiment, but that should work:
- Keep
JonathanWeblogicStartup
- Create another class
JonathanConcreteStartup
, locate as a source in your application code. - In
JonathanStartup.main()
, callJonathanConcreteStartup
This way,
- You keep a unique JAR in classpath that you do not need to update and you can forget.
- You can add, update or remove features in your very source code.
- The exploitation teams does not become hateful at you.
Add a Listener
The second one requires a bit more work.
- Create a class implementing
javax.servlet.ServletContextListener
interface, let’s sayMyLifecycleListener
. - Implement methods
contextInitialized()
andcontextDestroyed()
. - Edit your web.xml, add the following block:
<listener> <listener-class>lalou.jonathan.MyLifecycleListener</listener-class> </listener>
- Rebuild and deploy. It should be OK
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
EJB
3 andJPA
- BEA enhancements
- Web Services: more annotations, less XML
JAX-RPC
Web Services EnhancementsJAX-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
andweblogic-application.xml
, wizards, facets, Weblogic ClientGen,WSDLC
andJAXB
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 reliableJMS
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
connectionsJDBC
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 sameJAR
in differentEAR
s. - 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.
- IDE