草庐IT

spe_context_ptr_t

全部标签

Java/ Spring MVC : provide request context to child threads

我有一个问题,我想将我的SpringWebMVC应用程序的一些进程外包到单独的线程中。这很简单并且有效,直到我想使用一个类userRightService,它使用全局请求。这在线程中不可用,我们遇到了一个问题,这很容易理解。这是我的错误:java.lang.RuntimeException:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'scopedTarget.userRightsService':Scope'request'isnotactiveforthecurre

javax.naming.NameNotFoundException : Name [comp/env] is not bound in this Context. Java 调度程序无法找到 [comp] 错误

我想做的是在一段时间后更新我的数据库。所以我正在使用java调度程序和连接池。我不知道为什么,但我的代码只能工作一次。它将打印:initsuccesssuccessjavax.naming.NameNotFoundException:Name[comp/env]isnotboundinthisContext.Unabletofind[comp].atorg.apache.naming.NamingContext.lookup(NamingContext.java:820)atorg.apache.naming.NamingContext.lookup(NamingContext.jav

java - 在 Tomcat 7 中是否需要将 context.xml 复制到 conf/Catalina/locahost 中才能生效

刚从Tomcat6迁移到Tomcat7并注意到当您部署一个名为widget的Web应用程序时,META-INF/context.xml不再被复制到conf/Catalina/localhost/widget.xml。我不清楚是否需要,如果保留在META-INF中,是否会使用context.xml中的设置,或者它们是否仅在移动到conf/Catalina/localhost/widget.xml时才有效我使用的是vanillatomcat7安装 最佳答案 参见documentation(我的重点):IndividualContexte

java - 在 Spring Context @Configuration 中运行一个无效的设置方法

我希望在我的Spring上下文中执行几个设置方法。我目前有以下代码,但它不起作用,因为我说它们是beans并且没有返回类型。@Configuration@ComponentpublicclassMyServerContext{...//Works@BeanpublicUserDatauserData(){UserDatauserData=newAWSUserDataFetcher(urlUtil()).fetchUserData();returnuserData;}//Doesn'twork@BeanpublicvoidsetupKeyTrustStores(){//SetupTrus

java - 在 Jersey 中使用@Context HttpServletRequest 和@FormDataParam 进行多文件上传

我创建了一个jerseyrestfulweb服务,我使用@ContextHttpServletRequest请求作为方法签名设法上传多个文件工作得很好。事情是,要获取其他表单字段,我需要重复检查.isFormField();方法和相对.getName();文件或.getFieldName();和.getString();方法来检查必填字段是否存在每次调用web服务,我认为这很冗长如果还有其他几个字段,则过程昂贵。更简单的方法是使用@FormDataParam,其中web服务过去常常使用客户端需要传递的参数公开,但问题是我无法上传多个文件一去。因为如果媒体类型或编码类型为multipar

java - weblogic.application.ModuleException : Context path '' is already in use by the module:/application:

当我尝试运行weblogicserver12c时,它抛出此错误并且无法启动。出现这个错误后,此时服务器挂了并且不在这一行之后开始请帮助解决此错误。 最佳答案 停止weblogic服务器从weblogic的“autodeploy”文件夹中删除所有war文件。然后再次启动weblogic服务器之后在浏览器中输入URL“http://localhost:7001/console/”转到“配置应用程序”链接然后选择以前的项目并停止->工作完成时 关于java-weblogic.applicati

java - Spring框架配置问题 "prefix context for for element context:annotation-config is not bound"

我有一个奇怪的问题,我似乎无法找到。我可以毫无问题地与其他服务器一起使用,但我似乎无法让这台服务器正常工作。我看到的最接近我的问题的帖子是这篇帖子Theprefix"context"forelement"context:component-scan"isnotbound所有其他的确实只是因为前缀不在xml文件中。我希望有人能在这里指出我正确的方向。SpringXML文件:所以我知道了,但是出现了这个错误:org.xml.sax.SAXParseException:Theprefix"context"forelement"context:annotation-config"isnotbo

java : non-static variable cannot be referenced from a static context Error

以下代码在变量con2上生成错误,提示“无法从静态上下文错误中引用非静态变量con2。”我在Google上搜索了一个解决方案他们建议变量尚未初始化以使方法可用。我是否错误地初始化了它?我也尝试过将内容更改为公开,但这也无济于事。importjava.io.*;importjava.net.*;importjava.sql.*;importjava.sql.CallableStatement;importjava.sql.ResultSet;importjava.sql.PreparedStatement;importnet.sourceforge.jtds.jdbcx.JtdsData

java - @SpringBootTest 与@Sql : order of script execution and context initialization

我有在内存数据库上执行的集成测试。每个测试的签名大致如下所示:@RunWith(SpringRunner.class)@SpringBootTest@Sql("/clean-data-in-all-tables.sql")publicclassSomeTest{@TestpublicvoidshouldDoSomehting(){}}在测试上下文初始化期间,数据库模式由Hibernate重新创建:spring:jpa:hibernate:ddl-auto:create-drop我希望sql脚本在上下文初始化后执行,并在数据库模式生成后执行。然而,在某些情况下,clean-data-in

java - Google App Engine 上的 ServletContext 类路径中的 "context"在哪里?

我想使用我的GoogleAppEnginejava应用程序部署一些Freemarker模板,以用作电子邮件正文模板。我正在使用freemarker-gae-2.3.23.jar。我的问题是我应该将模板文件放在war文件的什么位置,以便Freemarker配置类可以找到它们?我认为WEB-INF/classes/templates可以工作,但是当我在GAE实例上运行它时出现以下错误。getRealPath()也没有给出任何见解。返回空字符串。非常感谢任何想法或建议。SEVERE:Template./templates/invitation.ftlnotfound.java.lang.Ru