[ http://jira.codehaus.org/browse/MSUREFIRE-110?page=all ]

Carlos Sanchez moved MNG-2249 to MSUREFIRE-110:
-----------------------------------------------

       Version:     (was: 2.0.4)
     Component:     (was: General)
    Complexity:   (was: Intermediate)
           Key: MSUREFIRE-110  (was: MNG-2249)
       Project: Maven 2.x Surefire Plugin  (was: Maven 2)

> JUnit test case fails with Maven 2 when looking up an Object in the JBoss 
> using JNDI
> ------------------------------------------------------------------------------------
>
>          Key: MSUREFIRE-110
>          URL: http://jira.codehaus.org/browse/MSUREFIRE-110
>      Project: Maven 2.x Surefire Plugin
>         Type: Bug

>  Environment: JBoss 4.0.1
> JDK 1.5
>     Reporter: Snehal Maniar
>     Priority: Critical

>
>
> For a sample JUnit test case trying to lookup an Object in the JBoss registry 
> using JNDI as shown below
> import java.util.Properties;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import junit.framework.TestCase;
> public class TestJBossJNDI extends TestCase {
>       public void testBindingCtx() throws Exception {
>               Properties p = new Properties();
>               p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>                               "org.jnp.interfaces.NamingContextFactory");
>               p.setProperty(Context.URL_PKG_PREFIXES,
>                               "org.jboss.naming:org.jnp.interfaces");
>               p.setProperty(Context.PROVIDER_URL, "jnp://sdv01:1399");
>               try {
>                       InitialContext ctx = new InitialContext(p);
>                       Object o = ctx.lookup("ConnectionFactory");
>                       System.out.println("Found Object = " + 
> o.getClass().getName());
>               } catch (Exception e) {
>                       e.printStackTrace();
>                       fail();
>               }
>       }
> }
> I get following exception/error....
> [INFO] 
> ----------------------------------------------------------------------------
> [INFO] Building Unnamed - middleware:TestMVN:jar:0.0.1
> [INFO]    task-segment: [test]
> [INFO] 
> ----------------------------------------------------------------------------
> [INFO] resources:resources
> [INFO] Using default encoding to copy filtered resources.
> [INFO] compiler:compile
> [INFO] Nothing to compile - all classes are up to date
> [INFO] resources:testResources
> [INFO] Using default encoding to copy filtered resources.
> [INFO] compiler:testCompile
> Compiling 1 source file to 
> C:\dev_corner\eclipse\workspaceII\TestMVN\target\test-classes
> [INFO] surefire:test
> [INFO] Setting reports dir: 
> C:\dev_corner\eclipse\workspaceII\TestMVN\target/surefire-reports
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> javax.naming.CommunicationException [Root exception is 
> java.rmi.ServerException: RemoteException occurred in server thread; nested 
> exception is: 
>       java.rmi.UnmarshalException: error unmarshalling arguments; nested 
> exception is: 
>       java.net.MalformedURLException: no protocol: and]
>       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:663)
>       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
>       at javax.naming.InitialContext.lookup(InitialContext.java:351)
>       at TestJBossJNDI.testBindingCtx(TestJBossJNDI.java:21)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at junit.framework.TestCase.runTest(TestCase.java:154)
>       at junit.framework.TestCase.runBare(TestCase.java:127)
>       at junit.framework.TestResult$1.protect(TestResult.java:106)
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>       at junit.framework.TestResult.run(TestResult.java:109)
>       at junit.framework.TestCase.run(TestCase.java:118)
>       at junit.framework.TestSuite.runTest(TestSuite.java:208)
>       at junit.framework.TestSuite.run(TestSuite.java:203)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at 
> org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:230)
>       at 
> org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:204)
>       at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:217)
>       at org.apache.maven.surefire.Surefire.run(Surefire.java:165)
>       at org.apache.maven.surefire.Surefire.run(Surefire.java:89)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at 
> org.apache.maven.surefire.SurefireBooter.runTestsInProcess(SurefireBooter.java:246)
>       at org.apache.maven.surefire.SurefireBooter.run(SurefireBooter.java:195)
>       at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:366)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
>       at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:472)
>       at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:413)
>       at org.maven.ide.eclipse.Maven2Executor.main(Maven2Executor.java:68)
> Caused by: java.rmi.ServerException: RemoteException occurred in server 
> thread; nested exception is: 
>       java.rmi.UnmarshalException: error unmarshalling arguments; nested 
> exception is: 
>       java.net.MalformedURLException: no protocol: and
>       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
>       at sun.rmi.transport.Transport$1.run(Transport.java:153)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>       at 
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>       at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
>       at java.lang.Thread.run(Thread.java:595)
>       at 
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
>       at 
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
>       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
>       at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
>       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
>       ... 41 more
> Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested 
> exception is: 
>       java.net.MalformedURLException: no protocol: and
>       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:282)
>       at sun.rmi.transport.Transport$1.run(Transport.java:153)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>       at 
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>       at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
>       at java.lang.Thread.run(Thread.java:595)
> Caused by: java.net.MalformedURLException: no protocol: and
>       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:747)
>       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
>       at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
>       at 
> org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:74)
>       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:1538)
>       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
>       at 
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
>       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
>       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
>       at javax.naming.CompoundName.readObject(CompoundName.java:554)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[surefire]
>  Running com.sabre.middleware.TestJBossJNDI
> [surefire] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 24.788 sec 
> <<<<<<<< FAILURE !! 
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at 
> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
>       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
>       at 
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
>       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
>       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
>       at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
>       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
> Results :
> [surefire] Tests run: 1, Failures: 1, Errors: 0
> [ERROR] mojo-execute : surefire:test
> Diagnosis: There are some test failure.
> FATAL ERROR: Error executing Maven for a project
> [ERROR] project-execute : middleware:TestMVN:jar:0.0.1 (  task-segment: 
> [test] )
> Diagnosis: There are some test failure.
> FATAL ERROR: Error executing Maven for a project
> org.apache.maven.lifecycle.LifecycleExecutionException: There are some test 
> failure.
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:556)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
>       at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:472)
>       at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:413)
>       at org.maven.ide.eclipse.Maven2Executor.main(Maven2Executor.java:68)
> Caused by: org.apache.maven.plugin.MojoExecutionException: There are some 
> test failure.
>       at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:384)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
>       ... 8 more
>       ... 6 more
> If the test case is ran outside of Maven 2 (mvn test), it runs just fine (no 
> errors/exceptions).
> pom.xml is listed below:
> <?xml version="1.0" encoding="UTF-8"?><project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>middleware</groupId>
>   <artifactId>TestMVN</artifactId>
>   <version>0.0.1</version>
>   <description></description>
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.5</source>
>           <target>1.5</target>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>   <repositories>
>     <repository>
>       <snapshots>
>         <enabled>false</enabled>
>       </snapshots>
>       <id>central</id>
>       <name>Maven Repository Switchboard</name>
>       <url>http://www.ibiblio.org/maven2</url>
>     </repository>
>     <repository>
>       <snapshots>
>         <enabled>false</enabled>
>       </snapshots>
>       <id>central</id>
>       <name>Maven Repository Switchboard</name>
>       <url>http://repo1.maven.org/maven2</url>
>     </repository>
>   </repositories>
>   <dependencies>
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>3.8.1</version>
>     </dependency>
>     <dependency>
>       <groupId>org.jboss</groupId>
>       <artifactId>jbossall-client</artifactId>
>       <version>4.0.1</version>
>     </dependency>
>   </dependencies>
> </project>
> Any prompt response to this issue is greatly appreciated...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to