Archive for the ‘en-US’ Category
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
Error:
While launching a WebLogic (10.3.3) server, I got the exception:
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
Fix:
Indeed, I had another WebLogic (9.2) instance running. Both of them were running in Debug mode, with the same debug port.
To fix the issue, check if your are not in the same situation: two applications running on the same debug port.
Another point is a little mysterious: when I run WebLogic 10 instance before the WebLogic 9, then an error occurs, too, but the message is different:
ERROR: transport error 202: bind failed: Address already in use ["transport.c",L41]
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) ["debugInit.c",L500]
JDWP exit error JVMTI_ERROR_INTERNAL(113): No transports initializedThe application has requested the JVM to exit with an fatal error from JNI. Error message:
JDWP No transports initialized, jvmtiError=JVMTI_ERROR_INTERNAL(113)
Press any key to continue . . .
Embedded error: Could not create task or type of type: apt.
Case:
In your Maven2’s pom.xml, you call Java’s APT (Annotation Processing Tool) via maven-antrun-plugin, to generate additional sources based on annotations in your java code.
[xml]<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>…</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<apt
srcdir="src/main/java/com/lalou/jonathan/"
destdir="classes" debug="on"
compile="false" factory="com.lalou.jonathan.Factory preprocessdir="generated-sources/javacc"
classpathref="cpannot" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>[/xml]
You get the following error:
Embedded error: Could not create task or type of type: apt.
Complete stacktrace:
[java]Embedded error: Could not create task or type of type: apt.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
– You have misspelt ‘apt’.
Fix: check your spelling.
– The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
– The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the ‘ant-‘ JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
– The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
– The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
– You are attempting to use a task defined using
<presetdef> or <macrodef> but have spelt wrong or not
defined it at the point of use
Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath
Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.[/java]
Fix:
At least in my case, the error is not related at all to Ant. Therefore, no use searching for any ant-apt.jar and placing in in Ant’s lib folder…
Indeed, the error is known and was fixed with Maven 2.0.10 release. You simply have to upgrade your Maven2 installation, and environment variables (M2_HOME).
Transaction Management with Spring in AOP
Case
You have a couple of Hibernate DAOs, in which a huge amount of code is duplicated: begin transactions, try/catch, close transactions, etc.
You would like to factorize your code.
Fix
- Define a
SessionFactory, let’s sayhibernateSessionFactory, with your own settings.[xml]<bean id="hibernateSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">(…)</bean>[/xml] - Define a
TransactionManager:[xml]<bean id="hibernateTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="hibernateSessionFactory" />
</property>
</bean>[/xml] - Define transactions advices:
[xml]<tx:advice id="hibTxManager" transaction-manager="hibernateTransactionManager">
<tx:attributes>
<tx:method name="*" propagation="NEVER" read-only="true" isolation="READ_COMMITTED" rollback-for="find*" no-rollback-for="dontFind*"/>
</tx:attributes>
</tx:advice>[/xml] name="*"–> the aspect will apply to all methods. You may filter on patterns such as find*, get*, save*, etc.propagation="NEVER"–> hints the propagation level. Available options areREQUIRED, SUPPORTS, MANDATORY,REQUIRES_NEW, NOT_SUPPORTED, NEVER, NESTED.isolation="READ_COMMITTED"–>rollback-for="find*"–> rollback all transactions following the given patternno-rollback-for="dontFind*"–> exceptions for rollbacks- Define the AOP configuration:
[xml]<aop:config>
<aop:pointcut id="hibOperation"
expression="execution(* com.lalou.jonathan.dao.hibernate.Hibernate*.*(..))" />
<aop:advisor pointcut-ref="hibOperation" advice-ref="hibTxManager" />
</aop:config>[/xml]
Many thanks to Jean-Pierre ISOARD for his help on this subject.
Deploy a webservice under Mule ESB using CXF
This short tutorial is aimed at showing the main steps allowing to deploy a WebService, using CXF framework, under a Mule ESB instance.
Java code
Declare an interface:
[java]@WebService
public interface BasicExampleServices {
@WebResult(name = "myReturnedInteger")
Integer getInteger(@WebParam(name="myInteger") Integer myInteger);
}[/java]
Implement this interface:
[java]@WebService(endpointInterface = "com.lalou.jonathan.services.BasicExampleServices", serviceName = "basicExampleServices")
public class WSBasicExampleServices implements BasicExampleServices {
public Integer getInteger(Integer param) {
return 12345;
}
}[/java]
XML files
Create a Spring config file ws-basicExample.xml:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="basicExampleService" scope="singleton"/>
</beans>[/xml]
Create a Mule configuration file ws-basicExample-config.xml:
[xml]<?xml version="1.0" encoding="UTF-8" ?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:management="http://www.mulesource.org/schema/mule/management/2.2"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.2"
xmlns:jetty="http://www.mulesource.org/schema/mule/jetty/2.2"
xsi:schemaLocation="http://www.mulesource.org/schema/mule/management/2.2
http://www.mulesource.org/schema/mule/management/2.2/mule-management.xsd
http://www.mulesource.org/schema/mule/core/2.2
http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.mulesource.org/schema/mule/vm/2.2
http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
http://www.mulesource.org/schema/mule/cxf/2.2
http://www.mulesource.org/schema/mule/cxf/2.2/mule-cxf.xsd
http://www.mulesource.org/schema/mule/stdio/2.2
http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd">
<spring:beans>
<spring:import resource="ws-basicExample.xml"/>
</spring:beans>
<model name="wsBasicExampleModel">
<service name="wsBasicExampleService">
<inbound>
<cxf:inbound-endpoint address="http://localhost:8282/services/basicExampleServices"/>
</inbound>
<component>
<spring-object bean="basicExampleService"/>
</component>
</service>
</model>
</mule>
[/xml]
Checks
- Run the Mule, pointing your config file.
- In your favorite webbrowser, open the URL:
[xml]http://localhost:8282/services/basicExampleServices?wsdl[/xml] - You can also execute a runtime test:
[java]public class WSBasicExampleServicesRuntimeTest {
private BasicExampleServices basicExampleServices;
@Before
public void setup() {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(BasicExampleServices.class);
factory.setAddress("http://localhost:8282/services/basicExampleServices");
basicExampleServices = (BasicExampleServices) factory.create();
}@Test
public void testGetInteger() {
final Integer expectedAnswer = 12345;
final Integer actualAnswer;
final Integer param = 912354;actualAnswer = basicExampleServices.getInteger(param);
assertNotNull(actualAnswer);
assertEquals(expectedAnswer, actualAnswer);
}}[/java]
The webservice contract is expected to be displayed.
Tutorial: Tomcat / OpenJMS integration
Install and Config
- Let’s assume you would like to run OpenJMS and Tomcat on the same server, eg
myLocalServer - Download OpenJMS from this page.
- Unzip the archive, extract it to
C:\exe\openjms-0.7.7-beta-1 - Set an environment variable:
set OPENJMS_HOME=C:\exe\openjms-0.7.7-beta-1 - Take the archive
$OPENJMS_HOME/lib/openjms-tunnel-0.7.7-beta-1.war- copy it to:
$CATALINA_HOME/webapps - rename it as:
openjms-tunnel.war
- copy it to:
- Edit
OPENJMS_HOME/config/openjms.xml:- Before the ending tag
</connectors>, add the block:<Connector scheme="http"> <ConnectionFactories> <ConnectionFactory name="HTTPConnectionFactory"/> </ConnectionFactories> </Connector>
- After the ending tag
</connectors>, add the block:<HttpConfiguration port="3030" bindAll="true" webServerHost="myLocalServer" webServerPort="8080" servlet="/openjms-tunnel/tunnel"/>
- Before the ending tag
Run applications
- Launch
$OPENJMS_HOME/bin/startup.bat. The following output is expected:OpenJMS 0.7.7-beta-1 The OpenJMS Group. (C) 1999-2007. All rights reserved. http://openjms.sourceforge.net 15:15:27.531 INFO [Main Thread] - Server accepting connections on tcp://myLocalServer:3035/ 15:15:27.547 INFO [Main Thread] - JNDI service accepting connections on tcp://myLocalServer:3035/ 15:15:27.547 INFO [Main Thread] - Admin service accepting connections on tcp://myLocalServer:3035/ 15:15:27.609 INFO [Main Thread] - Server accepting connections on rmi://myLocalServer:1099/ 15:15:27.609 INFO [Main Thread] - JNDI service accepting connections on rmi://myLocalServer:1099/ 15:15:27.625 INFO [Main Thread] - Admin service accepting connections on rmi://myLocalServer:1099/ 15:15:27.625 INFO [Main Thread] - Server accepting connections on http-server://myLocalServer:3030/ 15:15:27.625 INFO [Main Thread] - JNDI service accepting connections on http-server://myLocalServer:3030/ 15:15:27.625 INFO [Main Thread] - Admin service accepting connections on http-server://myLocalServer:3030/ - Launch Tomcat. A webapp with path
/openjms-tunneland display name “OpenJMS HTTP tunnel” should appear.
Checks
-
- Open Console² or an MS-DOS prompt
- Go to
$OPENJMS/examples/basic
- Run:
build. This will compile all the examples.
Check that OpenJMS is OK:
-
- Edit
jndi.properties,- Comment the property
java.naming.provider.url
- Add the line:
java.naming.provider.url=tcp://myLocalServer:3035
- Comment the property
- Run:
run Listener queue1
- Open a second tab
- Run:
run Sender queue1 5
- Expected output in the second tab:
C:\exe\openjms-0.7.7-beta-1\examples\basic>run Sender queue1 5 Using OPENJMS_HOME: ..\.. Using JAVA_HOME: C:\exe\beaweblo922\jdk150_10 Using CLASSPATH: .\;..\..\lib\openjms-0.7.7-beta-1.jar Sent: Message 1 Sent: Message 2 Sent: Message 3 Sent: Message 4 Sent: Message 5
- Expected output in the first tab:
C:\exe\openjms-0.7.7-beta-1\examples\basic>run Listener queue1 Using OPENJMS_HOME: C:\exe\openjms-0.7.7-beta-1 Using JAVA_HOME: C:\exe\beaweblo922\jdk150_10 Using CLASSPATH: .\;C:\exe\openjms-0.7.7-beta-1\lib\openjms-0.7.7-beta-1.jar Waiting for messages... Press [return] to quit Received: Message 1 Received: Message 2 Received: Message 3 Received: Message 4 Received: Message 5
- Expected output in the second tab:
- Edit
Check that OpenJMS/Tomcat link is OK:
Manual Check
-
- Stop the
Listenerinstance launched sooner - Edit
jndi.properties,- Comment the line
java.naming.provider.url=tcp://myLocalServer:3035
- Add the line:
java.naming.provider.url=http://myLocalServer:8080
(this is Tomcat manager URL)
- Comment the line
- Run:
run Listener queue1
- Open a second tab
- Run:
run Sender queue1 5
- The expected output are the same as above.
- Stop the
GUI Check
- Stop the
Listenerinstance launched sooner - Ensure
jndi.propertiescontains the line:java.naming.provider.url=http://myLocalServer:8080
- Run:
$OPENJMS_HOME/bin/admin.bat
- A Swing application should start.
- Go to:
Actions > Connections > Online
- The queue
queue1should be followed by a ‘0’. - Run:
run Sender queue1 50
-
Action > Refresh
- The queue
queue1should be followed by a ’50’.
-
- Run:
run Listener queue1
-
Action > Refresh
- The queue
queue1should be followed by a ‘0’.
-
GWT in noserver mode with Tomcat or WebLogic
Abstract
You would like to work on the client side of your GWT application, without building and deploying the Jetty server. Or, in the same way, you need test some server features available in WebLogic but not in Jetty, such as the EJB.
GWT 2.0 documentation, at the segment How do I use my own server in hosted mode instead of GWT’s built-in Jetty instance? is not precise at all on the 3rd step: it simply states:
“change the URL at the end of the argument list to match the URL you recorded in step #1.”
Process
- Let’s assume your WAR is deployed on
http://distantMachine:8080/myApplication. The servlet container may be Tomcat or WebLogic, it does not matter - In Eclipse, go in “
Run Configuration...“. Duplicate your current and classic GWT application configuration. - Go in
Server, uncheck “Run built-in server“. - In
Argumentstab, write the following line:
[java]-noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -war C:\eclipse\workspace\myApplication\src\main\webapp\lalou.jonathan.web.gwt.MyApplication -startupUrl http://distantMachine:8080/myApplication lalou.jonathan.web.gwt.MyApplication[/java] - Run
- The application is available at the following address:
[html]http://distantMachine:8080/muyApplication/?gwt.codesvr=127.0.0.1:9997[/html]
No source code is available for type org.junit.Assert; did you forget to inherit a required module?
Case
You run a GWT application, with a a service layer. Those services are tested through unit tests, which may use EasyMock, among other frameworks. Of course, you hinted at related jars, such us JUnit, by a <scope>test</scope> in your pom.xml.
Yet, when you run the GWT application with a Jetty light container, you get the following message:
Compiling module lalou.jonathan.gwt.client.MyModule
Validating newly compiled units
[java][ERROR] Errors in ‘file:/C:/eclipse/workspace/…/test/unit/lalou/jonathan/gwt/client//MyServiceUnitTest.java’
[ERROR] Line 26: No source code is available for type org.easymock.MockControl; did you forget to inherit a required module?
[ERROR] Line 76: No source code is available for type org.junit.Assert; did you forget to inherit a required module?[/java]
Fix
Since Maven2 and GWT scopes are fully independant, you have to modify you *.gwt.xml. Replace:
[xml] <source path=’client’/>[/xml]
with:
[xml]<source path=’client’ excludes="**/*UnitTest.java,**/*RuntimeTest.java"/>[/xml]
NB: Never forget that Google teams work with Ant, and not with Maven!
Error 403 with Maven 2 deployment
Case
This morning, I tried to redeploy an EAR on a WebLogic 9.2, using Maven 2 and a classical deployment profile. I got this issue:
[java][ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Error executing ant tasks
Embedded error: The following error occurred while executing this line:
(…)
weblogic.deploy.api.internal.utils.DeployerHelperException: The source ‘C:\DOCUME~1\myLogin\LOCALS~1\Temp\myApplication-ear.ear’ for the application ‘my-application-ear’ could not be loaded to the server ‘http://myServer:1234/bea_wls_deployment_internal/DeploymentService’.
Response: ‘403: Forbidden’ for url: ‘http://myServer:1234/bea_wls_deployment_internal/DeploymentService'[/java]
Yesterday, I got a similar error when I launched a mvn tomcat:deploy to deploy a WAR on a Tomcat 6.0 server:
[java][ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Cannot invoke Tomcat manager
Embedded error: Server returned HTTP response code: 403 for URL: http://myServer:3210/manager/deploy?path=%2FmyWebArchive&war=&update=true[/java]
Quick Fix
Running Maven2 in offline line, ie adding the option "-o", allows me to redeploy both the EAR on WebLogic and the WAR on Tomcat.
eg: mvn tomcat:deploy -o
I keep on investigating on this matter. I think there is an issue on the DNS. Indeed, when I deploy locally to my own machine myServer (ie with its network name), this error is raised, but when I deploy to localhost the build is successful.
No source code is available for type … ; did you forget to inherit a required module?
Context
In a GWT application, you have to use RPC calls, using entities which are package in external jar archives. With Eclipse, no error appears ; yet when you build the project with Maven2, you get this message:
[java][INFO] [ERROR] Errors in ‘file:/C:/eclipse/workspace/myGwtProject/src/java/com/lalou/jonathan/web/gwt/client/component/JonathanPanel.java’
(…)
[INFO] [ERROR] Line 24: No source code is available for type com.lalou.jonathan.domain.MyEntity; did you forget to inherit a required module?
(…)
[INFO] Finding entry point classes[/java]
Fix
In related jar
In the project to which MyEntity belongs to (here: my/depended/project):
- create a file
com/lalou/jonathan/MyDependedProject.gwt.xml, with as content:[xml]<module>
<source path="">
<include name="**/MyEntity.java"/>
</source>
</module>[/xml] - In the pom.xml:
- Add the source
MyEntity.javain built jar. This way, the Java file itself will be considered as a resource, like an XML or property file. To perform this, the quickest manner is to add the following block in thepom.xml:
[xml]<resources>
<resource>
<directory>${basedir}/src/java</directory>
<includes>
<include>**/MyEntity.java</include>
</includes>
</resource>
</resources>[/xml] - Add an
<include>**/*.gwt.xml</include>so that to have toMyDependedProject.gwt.xmlfile in the built jar.
In GWT project
In your
*.gwt.xmlfile, add the dependency:[xml]<inherits name=’com.lalou.jonathan.MyDependedProject’ />[/xml]
Caution!
All these operations need be done on all dependencies -either direct or indirect-. Therefore, possibly you may have a huge amount of code to be got.
Another issue appears when you use a jar of which you do not have the source code, such as in the case of tiers API for instance. - Add the source
GWT: call a remote EJB with Spring lookup
Abstract
Let’s assume you have followed the article “Basic RPC call with GWT“. Now you would like to call an actual EJB 2 as remote, via a Spring lookup.
Let’s say: you have an EJB MyEntrepriseComponentEJB, which implements an interface MyEntrepriseComponent. This EJB, generates a remote MyEntrepriseComponentRemote.
Entry Point
In myApplication.gwt.xml entry point file, after the line:
[xml]<inherits name=’com.google.gwt.user.User’/>[/xml]
add the block:
[xml]
<inherits name=’com.google.gwt.user.User’ />
<inherits name="com.google.gwt.i18n.I18N" />
<inherits name="com.google.gwt.http.HTTP" />[/xml]
Add the line:
[xml]<servlet path=’/fooService.do’/>[/xml]
Client
Under the *.gwt.client folder:
Update the service interface. Only the annotation parameter is amended:
[java]@RemoteServiceRelativePath("services/fooService")
public interface FooService extends RemoteService {
public String getHelloFoo(String fooName);
}[/java]
You have nothing to modify in asynchronous call interface (FooServiceAsync).
Server
Under the *.gwt.server folder, update the implementation for service interface:
Change the super-class, replacing RemoteServiceServlet with GWTSpringController:
[java]public class FooServiceImpl extends GWTSpringController implements FooService {
public FooServiceImpl() {
// init
}
}
[/java]
Add new field and its getter/setter:
[java]// retrieved via Spring
private myEntrepriseComponent myEntrepriseComponent;
public myEntrepriseComponent getMyEntrepriseComponent() {
return myEntrepriseComponent;
}
public void setmyEntrepriseComponent(myEntrepriseComponent _myEntrepriseComponent) {
myEntrepriseComponent = _myEntrepriseComponent;
}[/java]
Write the actual call to EJB service:
[java]
public String getHelloFoo(String fooName) {
return myEntrepriseComponent.getMyDataFromDB();
}
}[/java]
web.xml
Fill the web.xml file:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!– Spring –>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>gwt-controller</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>gwt-controller</servlet-name>
<url-pattern>/myApplication/services/*</url-pattern>
</servlet-mapping>
<!– Default page to serve –>
<welcome-file-list>
<welcome-file>MyApplicationGwt.html</welcome-file>
</welcome-file-list>
</web-app>
[/xml]
JNDI
Add a jndi.properties file in src/resources folder:
[java]
java.naming.provider.url=t3://localhost:12345
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.security.principal=yourLogin
java.naming.security.credentials=yourPassword
weblogic.jndi.enableDefaultUser=true[/java]
These properties will be used by Spring to lookup the remote EJB. The last option is very important, otherwise you may happen to face issues with EJB if they were deployed under WebLogic.
WEB-INF
In the WEB-INF folder, add an applicationContext.xml file:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<beans>
<util:properties id="jndiProperties" location="classpath:jndi.properties" />
<jee:remote-slsb id="myEntrepriseComponentService"
jndi-name="ejb.jonathan.my-entreprise-component"
business-interface="lalou.jonathan.myApplication.services.myEntrepriseComponent"
environment-ref="jndiProperties" cache-home="false"
lookup-home-on-startup="false" refresh-home-on-connect-failure="true" />
</beans>[/xml]
Add a gwt-controller-servlet.xml file:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<bean>
<property name="order" value="0" />
<property name="mappings">
<value>
/fooService=fooServiceImpl
</value>
</property>
</bean>
<bean id="fooServiceImpl"
class="lalou.jonathan.myApplication.web.gwt.server.FooServiceImpl">
<property name="myEntrepriseComponent" ref="myEntrepriseComponentService" />
</bean>
</beans>
[/xml]
Of course, if your servlet mapping name in web.xml is comoEstasAmigo, then rename gwt-controller-servlet.xml as comoEstasAmigo-servlet.xml 😉
Build and deploy
Now you can compile, package your war and deploy under Tomcat or WebLogic. WebLogic server may raise an error:
java.rmi.AccessException: [EJB:010160]Security Violation: User: '<anonymous>' has insufficient permission to access EJB
This error is related to the rights required to call a method on the EJB. Indeed, two levels of rights are used by WebLogic: firstly to lookup / instanciate the EJB (cf. the property java.naming.security.principal we set sooner), and another to call the method itself. In this second case, WebLogic requires an authentication (think of what you do when you login an web application deployed: your login and rights are kept for all the session) to grant the rights. I wish to handle this subject in a future post.
NB: thanks to David Chau and Didier Girard from SFEIR, Sachin from Mumbai team and PYC from NYC.