can not find Resource?

package testejb.session.stateless;

import javax.ejb.*;

import javax.sql.*;

import java.sql.*;

@Stateless

publicclass TestBeanimplements TestInterface{

@Resource(jndiName="java:/MYSQLDS",resourceType="javax.sql.DataSource")

public DataSource ds;

public String helloworld()

{

try{

Connection con=ds.getConnection();

DatabaseMetaData dma=con.getMetaData();

return dma.getDriverName();

}

catch(Exception x)

{

return"发生错误:"+x.getMessage();

}

}

}

when use ant to compile it says can not found class Resource

but if delete the code @Resource..., it can compiled succeed.

so where is Resource class?

it is not in the package javax.ejb?

I use jboss ejb3's lib , so puzzled with this, where can download the correct lib?

[1612 byte] By [dinghaijianga] at [2007-10-2 2:37:20]
# 1

> when use ant to compile it says can not found class

> Resource

> but if delete the code @Resource..., it can compiled

> succeed.

> so where is Resource class?

> it is not in the package javax.ejb?

No it is javax.annotation package.

> I use jboss ejb3's lib , so puzzled with this, where

> can download the correct lib?

Try using glassfish, Sun's open source applictaion server available at http://glassfish.dev.java.net/ which supports this resource injection.

Thanks,

Sahoo

sahooa at 2007-7-15 20:29:23 > top of Java-index,Enterprise & Remote Computing,AVK Portability...