beehive-user@incubator.apache.org
[Top] [All Lists]

Re: ControlException with JUnit

Subject: Re: ControlException with JUnit
From: "Eddie O'Neil"
Date: Mon, 01 Aug 2005 20:04:11 -0600
Tim--

  Glad that worked out.

And, just to let you know, as long as the "testdata" DataSource is bound in JNDI, the former using ConnectionDataSource should work as well.

  :)

Eddie



Timothy Brown wrote:
OK, so the simple answer is.....I was using the wrong config for my
connection:

Incorrect:
@JdbcControl.ConnectionDataSource(jndiName="java:/comp/env/jdbc/testdata")

Correct:
@JdbcControl.ConnectionDriver(databaseDriverClass="com.mysql.jdbc.Driver",
databaseURL="jdbc:mysql://localhost:3306/testdata",
                                   userName="system",
                                   password="today55")

Sorry about the quick email....It has been a long day, but getting better
all the time.

Tim

-----Original Message-----
From: Timothy Brown [mailto:tbrownagc@xxxxxxxxxxxxx] Sent: Monday, August 01, 2005 8:40 PM
To: beehive-user@xxxxxxxxxxxxxxxxxxxx
Subject: ControlException with JUnit

Hello all,

I am able to successfully create and work with beehive controls within
eclipse.  I am trying to use JUnit to run tests against these controls I
have created.  I am successful testing a basic hello world control, but get
the following error when I try to test a jdbcControl. Any ideas? Thanks,
Tim

org.apache.beehive.controls.api.ControlException: NamingException:[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]

            at
org.apache.beehive.controls.system.jdbc.JdbcControlImpl.getConnectionFromDat
aSource(JdbcControlImpl.java:418)

            at
org.apache.beehive.controls.system.jdbc.JdbcControlImpl.getConnection(JdbcCo
ntrolImpl.java:163)

            at
org.apache.beehive.controls.system.jdbc.JdbcControlImpl.onAquire(JdbcControl
Impl.java:110)

            at
org.apache.beehive.controls.system.jdbc.JdbcControlImplInitializer$_resource
ContextResourceEventsEventAdaptor.onAcquire(JdbcControlImplInitializer.java:
20)

            at
org.apache.beehive.controls.runtime.bean.ResourceContextImpl.acquire(Resourc
eContextImpl.java:127)

            at
org.apache.beehive.controls.runtime.bean.ResourceContextImpl.preInvoke(Resou
rceContextImpl.java:111)

            at
org.apache.beehive.controls.runtime.bean.ControlBean.preInvoke(ControlBean.j
ava:384)

            at
org.apache.beehive.controls.runtime.bean.ControlBean.preInvoke(ControlBean.j
ava:397)

            at
database.MySQLDBControlBean.getStateByZipCode(MySQLDBControlBean.java:164)

            at
businessService.CustomerServiceImpl.getStateByZipCode(CustomerServiceImpl.ja
va:44)

            at
businessService.CustomerServiceBean.getStateByZipCode(CustomerServiceBean.ja
va:162)

            at
test.businessService.TestCustomerService.testDeclarativeGetStatebyZipCode(Te
stCustomerService.java:63)

            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
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:478)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:344)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:196)

Caused by: 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

            at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)

            at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)

            at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)

            at javax.naming.InitialContext.lookup(InitialContext.java:351)

            at
org.apache.beehive.controls.system.jdbc.JdbcControlImpl.getConnectionFromDat
aSource(JdbcControlImpl.java:411)




<Prev in Thread] Current Thread [Next in Thread>