Я пытаюсь запустить свое веб-приложение в NetBeans с сервером Wildfly.Я получил ошибку
"jboss.naming.context.java.module.LocalShop.LocalShop.env.ReadBean.dp отсутствует [jboss.naming.context.java.jboss.datasources.shopstyles]", и я думаю,Строка @Resource (lookup = "java: jboss / datasources / shopstyles") вызывает ошибку.Кто-нибудь может мне помочь?
Структура пакета

MANIFEST.MF

Мой код для веб-приложения в NetBeans:
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.sql.DataSource;
@Named (value="readBean")
@RequestScoped
public class ReadBean implements Serializable {
@Resource (lookup= "java:jboss/datasources/shopstyles")
private DataSource dp;
public List<Veggie>performRead() throws SQLException{
if(dp == null){
throw new SQLException("Cannot access data pool");
}
List<Veggie>list;
try (Connection con =dp.getConnection()){
if(con == null){
throw new SQLException("Cannot establish connection to database");
}
PreparedStatement ps =con.prepareStatement("select veggie_id,name,price,created_date from veggie");
ResultSet result =ps.executeQuery();
list=new ArrayList<>();
while(result.next()){
Veggie veggie=new Veggie();
veggie.setVeggieID(result.getInt("veggie_id"));
veggie.setName(result.getString("name"));
veggie.setPrice(result.getString("price"));
veggie.setCreated_date(result.getDate("created_date"));
list.add(veggie);
}
}
return list;
}
}
Код Manifest.mf:
Версия Manifest: 1,0
Конфигурация NetBeans

Часть автономного
