Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon No handlers could be found for logger…

Case

You run a Python script, and you get an error similar to:
[python]No handlers could be found for logger "stomp.py"[/python]

Fix

Edit the script, and add the following block:
[python]import logging
logging.basicConfig()[/python]
This will produce explicit log that will allow you to identity the source of the actual issue.

PostHeaderIcon Tutorial: an Event Bus Handler for GWT / GXT

Overview

Introduction

Let’s consider a application, JonathanGwtApplication, divided in three main panels

  • a panel to select animal name name
  • a panel to display, expand and collapse trees of the animal ancestors
  • a panel of information to display many indicators (colors, ages, etc.).

An issue we encounter is: how to make the different panels communicate? In more technical terms, how to fire events from a panel to another one?

A first solution would be to declare each panel as listener to the other panels. Indeed, this principle may go further, and declare each component as listener to a list of other components…
Main drawbacks:

  • the code becomes hard to read
  • adding or removing a component requires to modify many parts of the code
  • we don’t follow GWT 2’s “philosophy”, which is to use Handlers rather than Listeners.

Hence, these reasons incited us to provide a global EventBusHandler.

The EventBusHandler concept

The EventBusHandler is a global bus which is aware of all events that should be shared between different panels, and fires them to the right components.
The EventBusHandler is a field of JonathanGwtApplicationContext.

Intrastructure

  • lalou.jonathan.application.web.gwt.animal.events.HandledEvent: generic interface for a event. Abstract method:
    [java]EventTypeEnum getEventEnum();[/java]
  • lalou.jonathan.application.web.gwt.animal.handler.EventHandler: generic interface for a component able to handle an event. Abstract method:
    [java]void handleEvent(HandledEvent handledEvent);[/java]
  • lalou.jonathan.application.web.gwt.animal.handler.EventHandlerBus: the actual bus. As a concrete class, it has two methods:
    [java]/**
    * Fires an event to all components declared as listening to this event
    * event type.
    *
    * @param baseEvent
    */
    public void fireEvent(HandledEvent baseEvent) {
    // …
    }

    /**
    * Adds an listener/handler for the event type given as parameter
    *
    * @param eventTypeEnum
    * @param eventHandler
    * @return The List of handlers for the key given as parameter. This list
    * contains the eventHandler that was given as second parameter
    */
    public List<EventHandler> put(EventTypeEnum eventTypeEnum,
    EventHandler eventHandler) {
    // …
    }[/java]

How to use the bus?

  1. Define an event: in JonathanGwtApplication, an event is decribed by two elements:
    • a functionnal entity: eg: “animal”, “food”, “tree node”. The functionnal entity must be isomorph to a technical DTO, eg: AnimalDTO for an entity Animal.(in the scope of this turoriel we assume to have DTOs, even though the entities may ne sufficient)
    • a technical description of the event: “selection changed”, “is expanded”
  2. Add an entry in the enum EventTypeEnum. Eg: “ANIMAL_SELECTION_CHANGED“
  3. in lalou.jonathan.application.web.gwt.animal.events, create an event, implementing HandledEvent and its method getEventEnum(). The match between EventTypeEnum and DTO is achieved here. Eg:
    [java]public class AnimalSelectionChangedEvent extends
    SelectionChangedEvent<AnimalDTO> implements HandledEvent {

    public AnimalSelectionChangedEvent(
    SelectionProvider<AnimalDTO> provider,
    List<AnimalDTO> selection) {
    super(provider, selection);
    }

    public EventTypeEnum getEventEnum() {
    return EventTypeEnum.ANIMAL_SELECTION_CHANGED;
    }

    }[/java]

  • When an event that should interest other component is fired, simply call the bus. The bus will identify the event type and dispatch it to the relevant handlers. eg:
    [java]animalComboBox.addSelectionChangedListener(new SelectionChangedListener<AnimalDTO>() {

    @Override
    public void selectionChanged(SelectionChangedEvent<AnimalDTO> se) {
    final AnimalDTO selectedAnimalVersion;
    selectedAnimalVersion= se.getSelectedItem();
    JonathanGwtApplicationContext.setSelectedAnimal(selectedAnimal);

    final AnimalSelectionChangedEvent baseEvent = new AnimalSelectionChangedEvent(
    se.getSelectionProvider(), se.getSelection());
    JonathanGwtApplicationContext.getEventHandlerBus()
    .fireEvent(baseEvent);

    }
    });[/java]

  • Handlers:
    • easy case: the component handles only one type of event: this handler must implement the right interface (eg: AnimalSelectionChangedEventHandler) and its method, eg:
      [java]protected void handleAnimalSelectionChangedEvent(HandledEvent handledEvent) {
      return;
      }[/java]
    • frequent case: the component handles two or more event types. No matter, make the component implement all the needed interfaces (eg: AnimalSelectionChangedEventHandler, FoodSelectionChangedEventHandler). Provide a unique entry point for the method to implement, which is common to both interfaces. Retrieve the event type, and handle it with ad hoc methods. Eg:
      [java]public void handleEvent(HandledEvent handledEvent) {
      final EventTypeEnum eventTypeEnum;

      eventTypeEnum = handledEvent.getEventEnum();

      switch (eventTypeEnum) {
      case ANIMAL_SELECTION_CHANGED:
      handleAnimalSelectionChangedEvent(handledEvent);
      return;
      case FOOD_SELECTION_CHANGED:
      handleFoodSelectionChangedEvent(handledEvent);
      return;
      default:
      break;
      }
      }

      protected void handleAnimalSelectionChangedEvent(HandledEvent handledEvent) {
      // do something
      }
      protected void handleFoodSelectionChangedEvent(HandledEvent handledEvent) {
      // do something else
      }[/java]

  • PostHeaderIcon SQL*Plus Does Not Update a Stored Procedure

    Case

    You have a stored procedure that you would like to update. The script is OK with TOAD, but raises an error when launched via SQL*Plus.

    Fix

    Add a slash (‘/’) or a dot (‘.’) at the end of file.

    PostHeaderIcon Use a JDBC datasource from WebLogic’s JNDI

    Case

    Your application is connected to a database. The configuration of the DB connexion is set in a Spring file. You would like the connexion to be set in WebLogic, so that no URL/login/password lays in your source code.

    Steps

    WebLogic

    Create a new data source:

    • go the WebLogic console >
      • JDBC >
        • DataSource >
          • New >
            • set the name, JNDI name (eg: database.jndi.name), DB type  (Oracle, Sybase, …) >
              • Next >
                • Select the driver >
                  • Next >
                    • Select the targeted server(s)

    This will

    1. create a new file <yourDomain>/config/jdbc/<datasourceName>-XXXX-jdbc.xml.
    2. add a <jdbc-system-resource> block in <yourDomain>/config/config.xml

    Spring

    Replace the block:

    [xml]<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${database.driver}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
    </bean>[/xml]

    with:

    [xml]<jee:jndi-lookup id="dataSource" jndi-name="${database.jndi.name}" />[/xml]

    PostHeaderIcon How to shutdown Hudson?

    Hudson is launched via a command line (java -jar hudson.war). But to shutdown it, provided that your Hudson is deployed on http://localhost:8080/hudson, you will have to open the following URL in your webbrowser:
    http://localhost:8080/hudson/exit

    PostHeaderIcon org.hibernate.HibernateException: identifier of an instance of … was altered from … to 0

    Case

    Stracktrace

    org.hibernate.HibernateException: identifier of an instance of lalou.jonathan.domain.Foo was altered from 183740934 to 0

    Sometimes, the error is slightly different: was altered from XXXX to null

    Here is a part of Hibernate mapping:

    [xml]<id name="fooId" column="fooId">
    <generator class="seqhilo">
    <param name="sequence">JL_Foo_SEQ</param>
    <param name="max_lo">10</param>
    </generator>
    </id>[/xml]

    Here is the Java code:

    [java]Foo sourceFoo = FooDAO.findById(xxxx);
    Foo foo = new Foo();
    foo = BeanUtils.copyProperties(sourceFoo);
    foo.setFooId(null);
    FooDAO.createFoo(foo);[/java]

    Explanation

    Using new Foo() instantiates an object of type Foo, with all its fields initialized at null (or zero for ints, floats, etc.). Writing explicitly foo.setFooId(null) removes the object from Hibernate current session.

    Fix

    Don’t set explicitly the fooId! Leave Hibernate initialize default values, and set handly other values, without using BeanUtils.

    PostHeaderIcon WebLogic Deployment with Maven: Dynamic Property Settings

    Case

    You have to deploy a WAR archive on a WebLogic server. To simplify the deployment process, you use weblogic-maven-plugin. Then, you only have to launch a mvn clean install weblogic:deploy to compile and deploy the WAR.

    Actually, the plugin configuration expects you to hard write the settings in the pom.xml, such as:

    [xml]<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>weblogic-maven-plugin</artifactId>
    <version>2.9.1</version>
    <configuration>
    <name>myWebApplication-web</name>
    <adminServerHostName>localhost</adminServerHostName>
    <adminServerPort>7001</adminServerPort>
    <adminServerProtocol>t3</adminServerProtocol>
    <targetNames>myTargetServer</targetNames>
    <userId>myUserId</userId>
    <password>myPassword</password>
    <securitymodel>Advanced</securitymodel>
    <artifactPath>${project.build.directory}/myWebApplication-web.war</artifactPath>
    </configuration>
    </plugin>[/xml]

    Yet, when you work on a multi-environment / multi-developper platform, hard writing the properties bothers. Production teams are not pleased, and, above all, it’s not safe.

    Unworking fix

    At first glance, I tried to use Maven filtering mechanisms. Anyway, this features was designed for compilation phase: properties are recopied from a property file to the actual one, and then included in the archive generated (may it be JAR, EAR or WAR); in a deployment phase, properties are not taken in account.
    http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files

    Unelegant fix

    Another solution is to set properties by profile. This works, but is not elegant at all: the password for production environment has to reason to be readable in the pom.xml used by a developper!

    Fix

    WebLogic / Maven plugin

    Add the following block:

    [xml]<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>weblogic-maven-plugin</artifactId>
    <version>2.9.1</version>
    <configuration>
    <name>myWebApplication-web</name>
    <adminServerHostName>${weblogic.server.name}</adminServerHostName>
    <adminServerPort>${weblogic.server.port}</adminServerPort>
    <adminServerProtocol>${weblogic.server.protocol}
    </adminServerProtocol>
    <targetNames>${weblogic.target}</targetNames>
    <userId>${weblogic.user}</userId>
    <password>${weblogic.password}</password>
    <securitymodel>${weblogic.security}</securitymodel>
    <artifactPath>${project.build.directory}/myWebApplication-web.war
    </artifactPath>
    </configuration>
    </plugin>[/xml]

    Properties / Maven plugin

    Under the tag, add the block:

    [xml]<properties>
    <weblogic.server.name>${myTargetServer.server.name}</weblogic.server.name>
    <weblogic.server.port>${myTargetServer.server.port}</weblogic.server.port>
    <weblogic.server.protocol>${myTargetServer.server.protocol}</weblogic.server.protocol>
    <weblogic.user>${myTargetServer.user}</weblogic.user>
    <weblogic.password>${myTargetServer.password}</weblogic.password>
    <weblogic.target>${myTargetServer.target}</weblogic.target>
    <weblogic.security>${myTargetServer.security}</weblogic.security>
    </properties>[/xml]

    Within the block, add the the following block:

    [xml]
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-2</version>
    <executions>
    <execution>
    <phase>initialize</phase>
    <goals>
    <goal>read-project-properties</goal>
    </goals>
    <configuration>
    <files>
    <file>conf/${maven.user}.myTargetServer.properties</file>
    </files>
    </configuration>
    </execution>
    </executions>
    </plugin>[/xml]

    Settings.xml

    Optionnaly, in your settings.xml, in your default profile, set the following property:

    [xml]<profile></pre>
    <id>myDefaultProfile</id>
    <properties>
    <maven.user>jonathan_lalou</maven.user>
    </properties>
    </profile>[/xml]

    You can decide to bypass this step. In this case, you will have to add the following parameter on launching Maven:
    -Dmaven.user=jonathan_lalou

    Property file

    Create a property file, with a name corresponding to the one you specified in maven.user property.

    [java]
    myTargetServer.server.name=localhost
    myTargetServer.server.port=7001
    myTargetServer.server.protocol=t3
    myTargetServer.user=myUserId
    myTargetServer.password=myPassword
    myTargetServer.target=myTargetServer
    myTargetServer.security=Advanced[/java]

    Now, you can launch mvn package weblogic:deploy. The WAR will be deployed on the right server.

    PostHeaderIcon Dynamic serviceUrl with Spring’s HttpInvokerProxyFactoryBean

    Abstract

    How to set dynamically the URL used by a HttpInvokerProxyFactoryBean in a Spring-deployed WAR?

    Detailed Case

    I have to deploy a GWT/GXT application, calling two distant services:
    a remote EJB
    a service accessed through Spring Remoting

    Here is the Spring configuration file I firstly used:

    [xml]
    <util:properties id="jndiProperties" location="classpath:jndi.properties"/>
    <jee:remote-slsb id="myRemoteEJBService" jndi-name="ejb.remote.myRemoteService"
    business-interface="lalou.jonathan.myRemoteEJBService"
    environment-ref="jndiProperties" cache-home="false"
    lookup-home-on-startup="false" refresh-home-on-connect-failure="true" />

    <bean id="mySpringRemoteService"
    class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceInterface"
    value="lalou.jonathan.services.mySpringRemoteService" />
    <property name="serviceUrl" value="${spring.remote.service.url}"/>
    </bean>
    [/xml]

    Unhappily, even though the remote EJB is retrieved (which proves that the jndi file is available in the classpath and rightly loaded), the Spring Remote service is not. I had to write the URL in hard in the configuration file… This is not very efficient when you work in a large team, with different production and testings environments!

    This is the log when myRemoteEJBService bean is loaded:
    [java]2010-08-17 16:05:42,937 DEBUG support.DefaultListableBeanFactory – Creating shared instance of singleton bean ‘myRemoteEJBService’
    2010-08-17 16:05:42,937 DEBUG support.DefaultListableBeanFactory – Creating instance of bean ‘myRemoteEJBService’
    2010-08-17 16:05:42,937 DEBUG support.DefaultListableBeanFactory – Eagerly caching bean ‘myRemoteEJBService’ to allow for resolving potential circular references
    2010-08-17 16:05:42,937 DEBUG support.DefaultListableBeanFactory – Returning cached instance of singleton bean ‘jndiProperties’
    2010-08-17 16:05:42,937 DEBUG support.DefaultListableBeanFactory – Invoking afterPropertiesSet() on bean with name ‘myRemoteEJBService’
    2010-08-17 16:05:42,937 DEBUG framework.JdkDynamicAopProxy – Creating JDK dynamic proxy: target source is EmptyTargetSource: no target class, static
    2010-08-17 16:05:42,953 DEBUG support.DefaultListableBeanFactory – Finished creating instance of bean ‘myRemoteEJBService'[/java]

    That is the log when mySpringRemoteService is loaded:
    [java]2010-08-17 16:05:42,968 DEBUG support.DefaultListableBeanFactory – Creating shared instance of singleton bean ‘mySpringRemoteService’
    2010-08-17 16:05:42,968 DEBUG support.DefaultListableBeanFactory – Creating instance of bean ‘mySpringRemoteService’
    2010-08-17 16:05:42,984 DEBUG support.DefaultListableBeanFactory – Eagerly caching bean ‘mySpringRemoteService’ to allow for resolving potential circular references
    2010-08-17 16:05:43,234 DEBUG support.DefaultListableBeanFactory – Invoking afterPropertiesSet() on bean with name ‘mySpringRemoteService’
    2010-08-17 16:05:43,250 DEBUG framework.JdkDynamicAopProxy – Creating JDK dynamic proxy: target source is EmptyTargetSource: no target class, static
    2010-08-17 16:05:43,250 DEBUG support.DefaultListableBeanFactory – Finished creating instance of bean ‘mySpringRemoteService'[/java]

    You can notice that no mention to jndiProperties appears. Here is the key of the problem: jndiProperties is considered as a bean among others, which cannot be accessed easyly from the HttpInvokerProxyFactoryBean.

    Fix

    To fix the issue, you have to add an actual property holder in Spring XML configuration file, ie after:

    [xml]<util:properties id="jndiProperties" location="classpath:jndi.properties"/>[/xml]

    add an instanciation of PropertyPlaceholderConfigurer:

    [xml]<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:jndi.properties"/>
    </bean>[/xml]

    PostHeaderIcon java.lang.OutOfMemoryError: PermGen space

    Case:

    I have to redeploy many times a day a WAR on a WebLogic 10 server, using Hotspot (Sun JVM) with Java 6. After some cycles deploy/undeploy, Hotspot crashes with the following error:

    java.lang.OutOfMemoryError: PermGen space

    Complete stacktrace:

    [java]2010-08-17 11:26:56,718 ERROR context.ContextLoader – Context initialization failed
    java.lang.IllegalStateException: Unable to load Java 1.5 dependent class [org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver]
    at org.springframework.beans.factory.support.AutowireUtils.createAutowireCandidateResolver(AutowireUtils.java:125)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:103)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:176)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:121)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:328)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:285)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:253)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:37)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:328)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:285)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:253)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:37)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:242)
    at org.springframework.beans.factory.support.AutowireUtils.createAutowireCandidateResolver(AutowireUtils.java:120)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:103)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:176)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:121)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    <Aug 17, 2010 11:26:56 AM CEST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: java.lang.IllegalStateException: Unable to load Java
    1.5 dependent class [org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver].
    java.lang.IllegalStateException: Unable to load Java 1.5 dependent class [org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver]
    at org.springframework.beans.factory.support.AutowireUtils.createAutowireCandidateResolver(AutowireUtils.java:125)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:103)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:176)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:121)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    Truncated. see log file for complete stacktrace

    Caused By: java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:328)
    Truncated. see log file for complete stacktrace
    >
    <Aug 17, 2010 11:26:56 AM CEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID ‘1282037204562’ for task ‘9’. Error is: ‘weblogic.application.ModuleException: ‘
    weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1514)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    Truncated. see log file for complete stacktrace

    Caused By: java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:328)
    Truncated. see log file for complete stacktrace
    >[/java]

    A short explanation

    The error seems to be linked to the garbage collection. From what I could read on the web, static objects used in CGlib (and/or jars depending on the library, such as the wide spread Hibernate, Spring, etc.) are the source of the crash.

    Fix

    Switching HotSpot to Oracle/BEA’s JVM, aka JRockit, makes the error (almost) disappear.
    Alternatively, if you can’t change the JVM, a workaround consists in upgrading the following parameter on JVM launching:
    -XX:MaxPermSize=256m

    PostHeaderIcon weblogic-maven-plugin / java.net.MalformedURLException: no protocol: and

    Case

    I run mvn weblogic:deploy, with a correct configuration inside pom.xml file, in order to deploy a WAR on a WebLogic 10 server. My development machine runs under Windows XP, the distant server is under Linux. I get the following error:
    java.net.MalformedURLException: no protocol: and

    Complete stacktrace:

    [java][INFO] Scanning for projects…
    [INFO] Searching repository for plugin with prefix: ‘weblogic’.
    [INFO] ————————————————————————
    [INFO] Building myWar Maven Webapp
    [INFO] task-segment: [weblogic:deploy]
    [INFO] ————————————————————————
    Downloading: http://repository.codehaus.org/weblogic/weblogic/9.0/weblogic-9.0.pom
    [INFO] Unable to find resource ‘weblogic:weblogic:pom:9.0’ in repository codehaus.org (http://repository.codehaus.org)
    Downloading: http://repo1.maven.org/maven2/weblogic/weblogic/9.0/weblogic-9.0.pom
    [INFO] Unable to find resource ‘weblogic:weblogic:pom:9.0’ in repository central (http://repo1.maven.org/maven2)
    Downloading: http://repo1.maven.org/maven2/weblogic/weblogic/9.0/weblogic-9.0.pom
    [INFO] Unable to find resource ‘weblogic:weblogic:pom:9.0’ in repository central (http://repo1.maven.org/maven2)
    Downloading: http://repository.codehaus.org/weblogic/webservices/9.0/webservices-9.0.pom
    [INFO] Unable to find resource ‘weblogic:webservices:pom:9.0’ in repository codehaus.org (http://repository.codehaus.org)
    Downloading: http://repo1.maven.org/maven2/weblogic/webservices/9.0/webservices-9.0.pom
    [INFO] Unable to find resource ‘weblogic:webservices:pom:9.0’ in repository central (http://repo1.maven.org/maven2)
    Downloading: http://repo1.maven.org/maven2/weblogic/webservices/9.0/webservices-9.0.pom
    [INFO] Unable to find resource ‘weblogic:webservices:pom:9.0’ in repository central (http://repo1.maven.org/maven2)
    [INFO] [weblogic:deploy]
    [INFO] Weblogic Deployment beginning with parameters DeployMojoBase[adminServerHostName = myLocalHost, adminServerProtocol = t3, adminServerPort = 7001, userId = weblogic, password = myPassword, artifactPath = C:\…\target/myWar.war, projectPackaging = war, name = myWar, targetNames = oneTier, remote = true]
    [INFO] Weblogic Deployment parameters [-adminurl, t3://myLocalHost:7001, -username, weblogic, -password, myPassword, -verbose, -debug, -name, myWar, -targets, muletier, -upload, -source, C:\…\target/myWar, -deploy]
    weblogic.Deployer invoked with options: -adminurl t3://myLocalHost:7001 -username weblogic -verbose -debug -name myWar -targets muletier -upload -source C:\workarea\development\primeweb\primeweb\projects\strategic\myWar\target/myWar -deploy
    [WebLogicDeploymentManagerImpl.<init>():103] : Constructing DeploymentManager for J2EE version V1_4
    deployments
    [WebLogicDeploymentManagerImpl.getNewConnection():146] : Connecting to admin server at myLocalHost:7001, as user weblogic
    [ServerConnectionImpl.getEnvironment():288] : setting environment
    [ServerConnectionImpl.getEnvironment():291] : getting context using t3://myLocalHost:7001
    [ServerConnectionImpl.getMBeanServer():239] : Connecting to MBeanServer at service:jmx:t3://myLocalHost:7001/jndi/weblogic.management.mbeanservers.domainruntime
    [ServerConnectionImpl.getMBeanServer():239] : Connecting to MBeanServer at service:jmx:t3://myLocalHost:7001/jndi/weblogic.management.mbeanservers.runtime
    [DomainManager.resetDomain():36] : Getting new domain
    [DomainManager.resetDomain():39] : Using pending domain: true
    [MBeanCache.addNotificationListener():96] : Adding notification listener for weblogic.deploy.api.spi.deploy.mbeans.TargetCache@19ccba
    [MBeanCache.addNotificationListener():107] : Disabling mbean caching due to: java.net.MalformedURLException: no protocol: and
    [MBeanCache.addNotificationListener():96] : Adding notification listener for weblogic.deploy.api.spi.deploy.mbeans.ModuleCache@ae1cf
    [MBeanCache.addNotificationListener():107] : Disabling mbean caching due to: java.net.MalformedURLException: no protocol: and
    [ServerConnectionImpl.initialize():171] : Connected to WLS domain: myMainDomain
    [ServerConnectionImpl.setRemote():482] : Running in remote mode
    [ServerConnectionImpl.init():161] : Initializing ServerConnection : weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl@a0e990
    [BasicOperation.dumpTmids():690] : Incoming tmids:
    [BasicOperation.dumpTmids():692] : {Target=muletier, WebLogicTargetType=server, Name=myWar}, targeted=true
    [BasicOperation.deriveAppName():139] : appname established as: myWar
    <Aug 16, 2010 11:46:42 AM CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, myWar [archive: C:\workarea\development\primeweb\primeweb\projects\strategic\myWar\target\myWar], to muletier .>
    [ServerConnectionImpl.upload():658] : Uploaded app to C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar
    [BasicOperation.dumpTmids():690] : Incoming tmids:
    [BasicOperation.dumpTmids():692] : {Target=muletier, WebLogicTargetType=server, Name=myWar}, targeted=true
    [BasicOperation.loadGeneralOptions():607] : Delete Files:false
    Timeout :3600000
    Targets:
    muletier
    ModuleTargets={}
    SubModuleTargets={}
    }
    Files:
    null
    Deployment Plan: null
    App root: C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar
    App config: C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar\plan
    Deployment Options: {isRetireGracefully=true,isGracefulProductionToAdmin=false,isGracefulIgnoreSessions=false,rmiGracePeriod=-1,retireTimeoutSecs=-1,undeployAllVersions=false,archiveVersion=null,planVersion=null,isLibrary=false,libSpecVersion=null,libImplVersion=null,stageMode=null,clusterTimeout=3600000,altDD=null,altWlsDD=null,name=myWar,securityModel=null,securityValidationEnabled=false,versionIdentifier=null,isTestMode=false,forceUndeployTimeout=0,defaultSubmoduleTargets=true,timeout=0}

    [BasicOperation.execute():424] : Initiating deploy operation for app, myWar, on targets:
    [BasicOperation.execute():426] : muletier
    <strong>java.net.MalformedURLException: no protocol: and</strong>
    at java.net.URL.<init>(URL.java:567)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:751)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
    at javax.management.remote.rmi.RMIConnectionImpl$6.run(RMIConnectionImpl.java:1513)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.unwrap(RMIConnectionImpl.java:1505)
    at javax.management.remote.rmi.RMIConnectionImpl.access$500(RMIConnectionImpl.java:72)
    at javax.management.remote.rmi.RMIConnectionImpl$7.run(RMIConnectionImpl.java:1548)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.unwrap(RMIConnectionImpl.java:1544)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:771)
    at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    [ServerConnectionImpl.close():334] : Closing DM connection
    [ServerConnectionImpl.close():354] : Unregistered all listeners
    [ServerConnectionImpl.closeJMX():374] : Closed JMX connection
    [ServerConnectionImpl.closeJMX():386] : Closed Runtime JMX connection
    [ServerConnectionImpl.closeJMX():398] : Closed Edit JMX connection[/java]

    Explanation

    Indeed, the " and " comes from the address of my local Maven 2 repository: C:\Documents and Settings\myLogin\.m2\repository, which is the default location. I consider this to be a bug of Mojo’s weblogic-maven-plugin plugin.

    Fix

    You do not have many choices :-(… You have to move your repository to a destination without blank spaces, such as C:\M2_repository.
    Then, take care to edit your settings.xml, and add the following block after <settings> tag:

    [xml]<localRepository>C:\M2_repository</localRepository>[/xml]