maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neo Anderson <javadeveloper...@yahoo.co.uk>
Subject Re: javax.naming.CommunicationException: Receive timed out problem
Date Mon, 03 Mar 2008 22:21:47 GMT
Thanks your reply. Finally I solved the problem. The problem comes from the wrong way to setup
initial context. The correct way to do that is by (in my test case, e.g., HelloTest)

    protected void setUp() throws Exception{
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        env.put(Context.PROVIDER_URL, "localhost");
        env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
        initialContext = new InitialContext(env);
    }

However, I encounter a new question. I use test case to call my ejb application (stateless
session bean). Thus I found out when executing command 'mvn clean install,'  it will do test
first, resulting failure because  the ejb artifact is still not yet deployed to the server.
How can deploy to and launch the server first before the test case executed. 

Thanks in advice.

----- Original Message ----
From: VUB Stefan Seidel <sseidel@vub.de>
To: Maven Users List <users@maven.apache.org>
Sent: Monday, 3 March, 2008 9:49:25 PM
Subject: Re: javax.naming.CommunicationException: Receive timed out problem

Hi,

this is most likely not a maven problem. It seems your test tries to 
connect to a remote JBoss instance but cannot contact it (not deployed?).

regards,

Stefan

Neo Anderson wrote:
> Hi
> 
> I am new to maven. And by following http://openejb.apache.org/3.0/simple-stateless-example.html
I write a simple stateless session bean (ejb3) to test the jboss and maven,but encounter a
problem. The error issues 
> 
> testHelloRemote(net.sf.sample.HelloTest)  Time elapsed: 5.06 sec  <<< ERROR!
> javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException:
Receive timed out]
> 
> The way how I test is 
> 
> 1.) create ejb module
> mvn archetype:create -DgroupId=net.sf.sample -DartifactId=hello -Dversion=1.0 
> 
> 2.) modify pom.xml (adding dependency to pom.xml and 1.5 compatible)
>     <build>
>         <pluginManagement>
>             <plugins>
>                 <plugin>
>                     <artifactId>maven-compiler-plugin</artifactId>
>                     <configuration>
>                         <source>1.5</source>
>                         <target>1.5</target>
>                     </configuration>                    
>                 </plugin>
>             </plugins>
>         </pluginManagement>
>     </build>
> ...
>     <dependency>
>         <groupId>jboss</groupId>
>         <artifactId>jboss-ejb3x</artifactId>
>         <version>4.0.3</version>
>         <scope>system</scope>
>         <systemPath>${basedir}\lib\jboss-ejb3x.jar</systemPath>
>     </dependency>
>     <dependency>
>         <groupId>jboss</groupId>
>         <artifactId>jnpserver</artifactId>
>         <version>1.0</version>
>         <scope>system</scope>
>         <systemPath>${basedir}\lib\jnpserver.jar</systemPath>
>     </dependency>
>     <dependency>
>         <groupId>jboss</groupId>
>         <artifactId>jboss-common</artifactId>
>         <version>1.0</version>
>         <scope>system</scope>
>         <systemPath>${basedir}\lib\jboss-common.jar</systemPath>
>     </dependency>
> 
> 3.)  write stateless session bean
> 
> package net.sf.sample;
> 
> import javax.ejb.Stateless;
> 
> @Stateless
> public class Hello implements HelloLocal, HelloRemote{
>     public String echo(){
>         return "hello\n";
> }    
> 
> package net.sf.sample;
> 
> import javax.ejb.Local;
> 
> @Local
> public interface HelloLocal{
>     public String echo();
> }
> 
> package net.sf.sample;
> 
> import javax.ejb.Remote;
> 
> @Remote
> public interface HelloRemote{
>     public String echo();
> 
> 
> 4.) run mvn command
> 
> mvn clean install
> 
> What might cause this problem?
> 
> Thank you very much,
> 
> env: jboss4.2.2.GA/ maven 2.0.8 / jdk1.6.0_04
> 
> 
> 
> 
> 
> 
>       __________________________________________________________
> Sent from Yahoo! Mail.
> A Smarter Inbox. http://uk.docs.yahoo.com/nowyoucan.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-- 
best regards,

Stefan Seidel
software developer
________________________
VUB Printmedia GmbH
Chopinstraße 4
D-04103 Leipzig
Germany
tel.    +49 (341) 9 60 50 07
fax.    +49 (341) 9 60 50 92
mail.   sseidel@vub.de
web.    www.vub.de

HRB Köln 24015
UStID DE 122 649 251
GF Dr. Achim Preuss Neudorf,
Dr. Christian Preuss Neudorf

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org






      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message