簡體   English   中英

在沒有數據源的Wildfly中啟動.war

[英]Launch .war in wildfly with no Datasource

我收到這個荒謬的錯誤:

jboss.naming.context.java.module.helloworld.helloworld.DefaultDataSource丟失[jboss.naming.context.java.jboss.datasources.ExampleDS]

我沒有得到,因為我的戰爭不使用持久性。 我真的需要一個數據源來發動戰爭嗎?

那不是錯誤。 JavaEE 7強制使用DefaultDataSource。 僅僅因為您沒有資源引用並不意味着您沒有查找它,所以Wildfly必須提供映射到ExampleDS的java:comp / DefaultDataSource:

EE.5.19 Default Data Source
The Java EE Platform requires that a Java EE Product Provider provide a database
in the operational environment (see Section EE.2.6, “Database”). The Java EE
Product Provider must also provide a preconfigured, default data source for use by
the application in accessing this database.

The Java EE Product Provider must make the default data source accessible to
the application under the JNDI name java:comp/DefaultDataSource.

The Application Component Provider or Deployer may explicitly bind a
DataSource resource reference to the default data source using the lookup element
of the Resource annotation or the lookup-name element of the resource-ref
deployment descriptor element. For example,

@Resource(lookup="java:comp/DefaultDataSource")
DataSource myDS;

In the absence of such a binding, the mapping of the reference will default to
the product's default data source.

For example, the following will map to a preconfigured data source for the
product's default database:

@Resource
DataSource myDS;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM