我遇到了一些僵局.我有一些由一些C#代码生成的查询.查询在Microsoft SQL Server Management Studio针对同一数据库运行时工作正常.
但是,当我的代码尝试运行相同的查询时,我得到关于无效列的相同错误,并抛出异常.引用此列的所有查询都失败.
最近将该列添加到数据库中.这是一个名为的日期列Incident_Begin_Time_ts.
失败的一个例子是:
select * from PerfDiag
where Incident_Begin_Time_ts > '2010-01-01 00:00:00';
Run Code Online (Sandbox Code Playgroud)
其他查询Select MAX(Incident_Being_Time_ts);在代码中运行时也会失败,因为它认为列缺失.
有任何想法吗?
我有一个批处理文件正在尝试运行以下命令:
\nFOR /F "tokens=1" %%G IN ('git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a') DO echo %%G \nRun Code Online (Sandbox Code Playgroud)\n这会导致 git error \xef\xbf\xbd\xef\xbf\xbdfatal: Invalid object name 'format'。
但是,如果我只是将命令本身放入批处理文件中,我就会得到预期的输出。
\ngit show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a\nRun Code Online (Sandbox Code Playgroud)\n生产:
\nFiles/MyFiles/header.html\nFiles/MyFiles/foo.html\nRun Code Online (Sandbox Code Playgroud)\n这个问题与周围的引号有关"format:"。
我尝试使用 来逃避它们"",但没有成功。我也尝试过^。我尝试过使用该usebackq参数。
如果你取出--pretty="format:"参数,这个循环也有效,但随后我会插入一堆额外的文本。
我有一些在本地运行良好的代码,但是当我尝试在远程服务器上运行它时,它会抛出一个空指针异常.尝试从Velocity获取模板时会这样做.它第一次失败,每次失败.
有问题的代码是这样的:
URL location = Thread.currentThread().getContextClassLoader().getResource("velocity.properties");
String fullPath = location.getPath();
log.debug("Path: " + fullPath);
Velocity.init(fullPath);
Template tmplt = Velocity.getTemplate( "template.html" ); //This line throws the error
Run Code Online (Sandbox Code Playgroud)
记录显示路径是正确的,我可以验证文件是否存在.
用于初始化velocity的属性文件包含:
resource.loader = file
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path=/var/lib/tomcat6/webapps/geoip/WEB-INF/templates/template.html
file.resource.loader.cache = true
input.encoding=UTF-8
output.encoding=UTF-8
Run Code Online (Sandbox Code Playgroud)
错误的堆栈跟踪如下所示:
SEVERE: Servlet.service() for servlet Jersey REST Service threw exception
java.lang.NullPointerException
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:299)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:358)
at ca.company.ipservice.models.MyClass.toHTML(MyClass.java:48)
Run Code Online (Sandbox Code Playgroud)
我用Google搜索并搜索了StackOverflow,但我找不到任何答案.有任何想法吗?
apache ×1
batch-file ×1
escaping ×1
java ×1
jersey ×1
powershell ×1
sql ×1
sql-server ×1
tomcat ×1
velocity ×1
windows ×1