FYI - I'm using almost the same resin.conf file that I use when just running
the container normally. The only difference is that I moved the directories
all to "." (this seemed necessary to get the container to start up at all).
<caucho.com>
<java compiler='internal' work-dir='work'/>
<resource-ref>
...
</resource-ref>
<http-server app-dir='.'>
<host id=''>
<war-dir>.</war-dir>
<war-expand-dir>.</war-expand-dir>
...
</host>
</http-server>
</caucho.com>
The method throwing the error looks like this:
public static DataSource getDataSource() throws NamingException {
Context ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource) ctx.lookup("/jdbc/cheli");
return ds;
}
that's it. If this triggers any ideas for you, please let me know.
----- Original Message -----
From: "Vincent Massol" <[EMAIL PROTECTED]>
To: "'Cactus Users List'" <[EMAIL PROTECTED]>
Cc: "'Maven Users List'" <[EMAIL PROTECTED]>
Sent: Saturday, November 01, 2003 2:36 PM
Subject: RE: NoInitialContextException
> Hi David,
>
> The Cactus plugin has moved to the Cactus project. Thus in the future,
> you'll get better chance to get answer there.
>
> >From what you say, I reckon you're using the resinconf attribute of the
> <cactus> task and thus you are providing your own resin.conf file.
>
> The error you get seem to be purely Resin related and does not seem to
> have any relationship with Cactus. From the error you're getting it
> seems you are doing a lookup and you haven't defined which JNDI
> factory/server/credential to use for that. Normally it is not needed
> when you run inside the container. Is it possible that you are trying to
> lookup the data source from client code (for example, in a beginXXX or
> endXXX method)?
>
> Thanks
> -Vincent
>
> PS: I'm cc-ing the cactus user list as this is now the correct place for
> Cactus related questions. See
> http://jakarta.apache.org/cactus/mailinglist.html
>
> > -----Original Message-----
> > From: David Chelimsky [mailto:[EMAIL PROTECTED]
> > Sent: 01 November 2003 21:19
> > To: [EMAIL PROTECTED]
> > Subject: NoInitialContextException
> >
> > Hi. I'm trying to use Maven to run cactus tests in a resin-2.1.9
> > container. I've been able to get tests to execute in this environment,
> but
> > have not been successful thus far in executing tests that are actually
> > interacting w/ the container.
> >
> > I'm trying to verify access to a DataSource that is set up in
> resin.conf.
> > My DAO method looks up the datasource in JNDI, but I get the error
> below,
> > stating that java.naming.factory.initial needs to be set up. I would
> > assume that this is the responsibility of resin (isn't that one of the
> > primary reasons for running integration tests in the container?).
> >
> > Here's a couple of things to bear in mind:
> > 1/ The app actually works and I'm backfilling integration tests now.
> > 2/ I've verified that the correct resin.conf is being used
> >
> > Any other ideas?
> >
> > Thanks,
> > David
> >
> > cactus:test:
> > [cactus]
> -------------------------------------------------------------
> > ----
> > [cactus] Running tests against Resin 2.x
> > [cactus]
> -------------------------------------------------------------
> > ----
> > [cactus] Deleting 42 files from
> > C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cactus\resin2x
> > [cactus] Deleted 22 directories from
> > C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cactus\resin2x
> > [cactus] Testsuite: org.chelimsky.tools.dao.TestGetDataSource
> > [cactus] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.513
> sec
> > [cactus]
> > [cactus] Testcase: testGetDataSource took 0.11 sec
> > [cactus] Caused an ERROR
> > [cactus] Need to specify class name in environment or system
> property,
> > or as an applet parameter, or in an application resource file:
> > java.naming.factory.initial
> > [cactus] javax.naming.NoInitialContextException: Need to specify
> class
> > name in environment or system property, or as an applet parameter, or
> in
> > an application resource file: java.naming.factory.initial
> > [cactus] at
> >
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
> > [cactus] at
> > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
> > [cactus] at
> >
> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:2
> 80
> > )
> > [cactus] at
> > javax.naming.InitialContext.lookup(InitialContext.java:347)
> > [cactus] at
> > org.chelimsky.tools.dao.DaoUtil.getDataSource(DaoUtil.java:60)
> > [cactus] at
> >
> org.chelimsky.tools.dao.TestGetDataSource.testGetDataSource(TestGetDataS
> ou
> > rce.java:40)
> > [cactus] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > [cactus] at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:
> > 39)
> > [cactus] at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Im
> > pl.java:25)
> > [cactus]
> > [cactus] Testcase: testGetDataSource
> > [cactus] [ERROR] TEST org.chelimsky.tools.dao.TestGetDataSource
> FAILED
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>