我正在尝试在Tomcat上部署WAR,但是在某些环境变量中却出现了异常,如
javax.naming.NameNotFoundException: Name [smartconnect.filestorelocation] is not bound in this Context.
我在server.xml的Environment
标记内有名称
<Environment name="smartconnect.filestorelocation" value="/var/www/html/me/smart/filestore" type="java.lang.String" override="false" />
<Environment name="smartconnect.dataqueue_cleanup_days" value="30" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.spatial_ref_sys_table" value="public.spatial_ref_sys" type="java.lang.String" override="false" />
<Environment name="smartconnect.number_background_threads" value="5" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.work_item_history_days_available" value="5" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.changelog_cleanup_days" value="5" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.ca_export_days_available" value="5" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.sync_download_hours_available" value="5" type="java.lang.Integer" override="false" />
<Environment name="smartconnect.cleanup_task_interval_hours" value="5" type="java.lang.Integer" override="false" />
服务器的context.xml
如下:
<Context>
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/smart"
userTable="connect.users" userNameCol="username"
userCredCol="password" userRoleTable="connect.user_roles" roleNameCol="role_id"
localDataSource="true">
<CredentialHandler className="org.wcs.smart.connect.apache.BcryptCredentialHandler"/>
</Realm>
</Realm>
<ResourceLink global="org.wcs.smart.connect.datasource.postgresql" name="jdbc/smart"/>
<ResourceLink global="smartconnect.filestorelocation" name="smartconnect.filestorelocation"/>
<ResourceLink global="smartconnect.dataqueue_cleanup_days" name="smartconnect.dataqueue_cleanup_days"/>
<ResourceLink global="smartconnect.spatial_ref_sys_table" name="smartconnect.spatial_ref_sys_table"/>
<ResourceLink global="smartconnect.number_background_threads" name="smartconnect.number_background_threads"/>
<ResourceLink global="smartconnect.work_item_history_days_available" name="smartconnect.work_item_history_days_available"/>
<ResourceLink global="smartconnect.changelog_cleanup_days" name="smartconnect.changelog_cleanup_days"/>
<ResourceLink global="smartconnect.ca_export_days_available" name="smartconnect.ca_export_days_available"/>
<ResourceLink global="smartconnect.sync_download_hours_available" name="smartconnect.sync_download_hours_available"/>
<ResourceLink global="smartconnect.cleanup_task_interval_hours" name="smartconnect.cleanup_task_interval_hours"/>
<ResourceLink global="mail/Session" name="mail/Session"/>
</Context>
有人知道我该如何解决该错误?
谢谢。
答案 0 :(得分:0)
为什么在context.xml中有[smartconnect.filestorelocation]变量,而在server.xml中也没有?我认为您引用的是在server.xml中未定义的变量smartconnect.filestorelocation的context.xml中