jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicole Luneburg <Nicole.Luneb...@lisasoft.com>
Subject RE: How to set user principal in setUp()
Date Tue, 13 Jan 2009 04:19:59 GMT
Hi Petar,

Thanks for your reply.
I repeated the steps outlined, it seems doing a mvn clean install is only successful with
the latest cactus tag (1.8.0).
Doing a mvn clean install from trunk throws the following error:

-- start

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.cactus.integration.maven2.test.TestCactifyWarMojo
[INFO] Analyzing war: C:\Sandbox\cactus\integration\maven2;\null
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.126 sec
Running org.apache.cactus.integration.maven2.test.TestCactifyEarMojo
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.187 sec <<< FAILURE!

Results :

Tests in error:
  testCactifyEarWithNoParametersSpecified(org.apache.cactus.integration.maven2.test.TestCactifyEarMojo)

Tests run: 5, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 18 seconds
[INFO] Finished at: Tue Jan 13 11:00:19 CST 2009
[INFO] Final Memory: 45M/63M
[INFO] ------------------------------------------------------------------------

C:\Sandbox\cactus>

-- end

Nonetheless since this appears to just be a test, I didn't think it would affect what I'm
trying to do, so I continued on.

Starting the test with ant throws the following error:

-- start

C:\Sandbox\cactus\samples\ejb3>ant
Buildfile: build.xml

init:

prepare:
    [mkdir] Created dir: C:\Sandbox\cactus\samples\ejb3\target\classes
    [mkdir] Created dir: C:\Sandbox\cactus\samples\ejb3\target\cactus
    [mkdir] Created dir: C:\Sandbox\cactus\samples\ejb3\target\logs
    [mkdir] Created dir: C:\Sandbox\cactus\samples\ejb3\target\reports

resolve:

BUILD FAILED
C:\Sandbox\cactus\samples\ejb3\build.xml:95: Problem: failed to create task or type antlib:org.apache.ivy.ant:configure
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
        -c:\programs\apache-ant-1.7.1\bin\..\lib
        -C:\Documents and Settings\nicole\.ant\lib
        -a directory added on the command line with the -lib argument


Total time: 0 seconds
C:\Sandbox\cactus\samples\ejb3>

-- end

Googling this error indicated that I was missing an ivy jar file, so I downloaded ivy rc2
from http://ant.apache.org/ivy/ and put it in my $ANT_HOME\lib directory.
Alternatively the following command can also be done:

ant -lib ivy-2.0.0-rc2.jar

(This still had some missing jars from the repository error so I put those in myself (I think
it was just 1 this time, geronimo or something)).

This failed with some errors which turned out to be a JBoss 4.2.2 problem.
After upgrading to 4.2.3 it ran.

Before running ant though I added a test for the MyEJB3ServiceBean class, as follows:

-- start

package org.apache.cactus.sample.ejb3;

import java.util.Properties;
import javax.naming.InitialContext;
import junit.framework.TestCase;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.sample.ejb3.IMyEJB3ServiceBean;

public class TestMyEJB3ServiceBean extends ServletTestCase
{
    /**
     * Class under test
     */
    private IMyEJB3ServiceBean serviceBean;

    /**
     * @see TestCase#setUp()
     */
    public void setUp() throws Exception
    {
        Properties properties = new Properties();
        properties.put("java.naming.factory.initial",
            "org.jnp.interfaces.NamingContextFactory");
        properties.put("java.naming.factory.url.pkgs",
            "org.jboss.naming rg.jnp.interfaces");
        InitialContext ctx = new InitialContext(properties);


        serviceBean = (IMyEJB3ServiceBean) ctx.lookup("cactus.samples.ejb3-cactified/"+MyEJB3ServiceBean.class.getSimpleName()+"/local");
    }

    public void testCheckPermissions() throws Exception
    {
        boolean result = this.serviceBean.checkPermissions();
        System.out.println("result is: " + result);
    }
}

-- end

Then I ran it, which failed.
For lack of knowledge on all this I could not get any System.out.println to show anywhere
(not in my console or in output.log).
I also put printlns in TestConverterEJB.

So anyway I looked in the TEST-org.apache.cactus.sample.ejb3.TestMyEJB3ServiceBean.xml ...
my dreaded error :(

-- start

  <testcase classname="org.apache.cactus.sample.ejb3.TestMyEJB3ServiceBean" name="testCheckPermissions"
time="0.14">
    <error message="java.lang.IllegalStateException: No valid security context for the
caller identity" type="org.apache.cactus.internal.client.ServletExceptionWrapper">javax.ejb.EJBException:
java.lang.IllegalStateException: No valid security context for the caller identity
        at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)

-- end

I've gone through the instructions twice now with the same result, surely I am doing something
wrong or we have different a configuration somewhere :(

Nicole

Ps. This has taken me a while because I had not used some of the mentioned technologies before
such as maven, cargo, ivy.
Learn something new everyday :)

-----Original Message-----
From: Petar Tahchiev [mailto:paranoiabla@gmail.com]
Sent: Monday, 12 January 2009 6:36 PM
To: Cactus Users List
Subject: Re: How to set user principal in setUp()

Hi Nicole,

no it seems that you are missing these

[ivy:retrieve]          ::
org.apache.cactus#cactus.integration.ant;1.8.1-SNAPSHOT: not found
[ivy:retrieve]          :: javax.servlet#jstl;1.1.2: not found
[ivy:retrieve]          ::
org.apache.geronimo.specs#geronimo-ejb_3.0_spec;1.0: not found
[ivy:retrieve]          :: jaxen#jaxen;1.1.1: not found

files in your mavne2 repo (c:\documents and
settings\<user>\.m2\repository\). Ivy is trying to copy
these files from the maven2 repo to the ivy cache.
This could be due to the fact that you did not build the cactus project
as I said in step (2).

Cheers, Petar.


The contents of this email are confidential and may be subject to legal or professional privilege
and copyright. No representation is made that this email is free of viruses or other defects.
If you have received this communication in error, you may not copy or distribute any part
of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect
receipt of this correspondence.

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org


Mime
View raw message