My simple stateless session beans (API layer) talk to our domain
Java classes that are persisted by jBoss.
It is this persistence layer that talks to jBoss and passes the
string "java:comp/env/stuDB" to the TOPLink JNDIConnector class.
This is all within the bean jar.
The TOPLink JNDIConnector class does the following.
small extract...
constructor...
public JNDIConnector(Context context, String name)
throws ValidationException {
try {
this.initialize(context, new CompositeName(name));
} catch (InvalidNameException e) {
throw ValidationException.invalidDataSourceName(name, e);
}
}
and method...
public Connection connect(Properties properties) throws DatabaseException,
ValidationException {
String user = properties.getProperty("user");
String password = properties.getProperty("password");
DataSource dataSource;
try {
dataSource = (DataSource) this.getContext().lookup(this.getName());
} catch (NamingException exception) {
throw ValidationException.cannotAcquireDataSource(this.getName(),
exception);
}
try {
return dataSource.getConnection(user, password);
} catch (SQLException exception) {
throw DatabaseException.sqlException(exception);
}
}
So from this you can see the reason they get the InvalidName
exception is because they construct a CompositeName from
"java:comp/env/stuDB".
Should they be constructing a CompondName?
I think I will talk to TOPLink a bit more about this problem.
Thanks.
Rickard �berg wrote:
>
> Hey
>
> Rickard �berg wrote:
> > Stuart Barlow wrote:
> > > Maybe a good question Rickard. :-)
> > > This is what TOPLink are doing in their JNDIConnector code when
> > > I pass them a string.
>
> Just exactly when is this code run? I mean, it has to be from "within" a
> bean or otherwise it wouldn't be able to see the java: namespace. Right?
>
> /Rickard
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]