- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将 Spring 与 Drools 集成,但全局变量有问题。当我作为 Java 应用程序运行我的代码时,没有问题,但如果我作为 Spring 应用程序运行我的代码,我得到了全局预期 com.package.sameobj 发现 com.package.sameobj 的非法类错误
作为 Java 应用程序运行,一切正常:
package com.softarts.app;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import com.softarts.app.logic.Embargo;
import com.softarts.app.logic.Entidad;
import com.softarts.app.services.SystemExpertConfiguration;
import com.softarts.app.services.SystemExpertService;
public class main {
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new AnnotationConfigApplicationContext(SystemExpertConfiguration.class);
SystemExpertService systemExpertService= (SystemExpertService) context.getBean(SystemExpertService.class);
String s=systemExpertService.calculateEmbargo();
System.out.println(s);
}
}
作为 Spring 应用程序运行,我收到此错误
java.lang.RuntimeException: Illegal class for global. Expected [com.softarts.app.systemexpert.datos.DataAmount], found [com.softarts.app.systemexpert.datos.DataAmount].
at org.drools.core.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:1202)
at com.softarts.app.services.SystemExpertService.calculateEmbargo(SystemExpertService.java:28)
at com.softarts.app.controllers.DocumentController.uploadMultipleFiles(DocumentController.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:142)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:901)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:154)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:122)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:107)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
这是我的代码,
package com.softarts.app.services;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.KieModule;
import org.kie.api.runtime.KieContainer;
import org.kie.internal.io.ResourceFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("com.softarts.app.services")
public class SystemExpertConfiguration {
public static final String drlFile = "reglas.drl";
@Bean
public KieContainer kieContainer() {
KieServices kieServices = KieServices.Factory.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write(ResourceFactory.newClassPathResource(drlFile));
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
return kieServices.newKieContainer(kieModule.getReleaseId());
}
}
并且,
package com.softarts.app.services;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.softarts.app.systemexpert.datos.DataAmount;
import com.softarts.app.systemexpert.model.Cuenta;
import com.softarts.app.systemexpert.enumeraciones.*;
import com.softarts.app.logic.Embargo;
import com.softarts.app.logic.Entidad;
@Service
public class SystemExpertService {
@Autowired
private KieContainer kContainer;
public String calculateEmbargo() {
KieSession kieSession = kContainer.newKieSession();
DataAmount datos = new DataAmount();
kieSession.setGlobal("datos", datos);
ArrayList<Cuenta> cuentas = new ArrayList<>();
cuentas.add(new Cuenta(TipoCuenta.AHORROS, SubtipoCuenta.BASICA, new BigDecimal(1000000),
LocalDate.of(2018, 11, 24)));
Embargo embargo = new Embargo();
for (Cuenta cuenta : cuentas) {
kieSession.insert(cuenta);
}
kieSession.insert(embargo);
kieSession.fireAllRules();
kieSession.dispose();
String informacion = "";
for (Cuenta cuenta : cuentas) {
informacion += "->La cuenta de " + cuenta.getTipo() + " de " + cuenta.getSubtipo() + " por un valor de "
+ cuenta.getMontoEmbargado() + "\n";
informacion += " en base a las siguientes leyes:" + "\n";
for (String regla : cuenta.getReglas()) {
informacion += "\t" + regla + "\n";
}
}
informacion += "El monto total embargado es: " + embargo.getMontoEmbargado() + "\n";
informacion += "El monto restante de embargar es: "
+ (embargo.getMontoEmbargar().subtract(embargo.getMontoEmbargado())) + "\n";
return informacion;
}
}
我从我的 Controller 调用该服务
@PostMapping("uploadMultiple")
public String uploadMultipleFiles(@RequestParam("files") List<MultipartFile> files,
RedirectAttributes redirectAttributes, Model model) {
if (files.size() == 0) {
redirectAttributes.addFlashAttribute("info", "Please select a file to upload");
return "redirect:/docs/carga";
}
try {
// uploadFileService.saveMultipleFiles(files);
List<Embargo> embargos = new ArrayList<>();
List<InputStream> inputs = new ArrayList<>();
List<String> filenames = new ArrayList<>();
for (MultipartFile file : files) {
inputs.add(file.getInputStream());
System.out.println(file.getOriginalFilename());
filenames.add(file.getOriginalFilename().split("\\.")[0]);
}
List<String> texts = detectMultipleText(inputs);
int aux = 0;
for (String text : texts) {
GrammarModule grammar = new GrammarModule(text);
Embargo embargo = new Embargo(grammar.getDemandantes(), grammar.getDemandados(), grammar.getCuenta(),
grammar.getDireccion(), grammar.getFecha(), grammar.getMonto(), grammar.getOficio(),
grammar.getReferencia());
embargos.add(embargo);
for (Entidad entidad : embargo.getDemandados()) {
entidad.setCuenta(DataClass.selectCuentas(entidad.getIdentificacion()));
}
//////////////////////////
//HERE I CALL THE SERVICE/
/////////////////////////
ApplicationContext context = new AnnotationConfigApplicationContext(SystemExpertConfiguration.class);
SystemExpertService systemExpertService= (SystemExpertService) context.getBean(SystemExpertService.class);
String s=systemExpertService.calculateEmbargo();
System.out.println(s);
// Generando documento de respuesta
GeneratorModule gen = new GeneratorModule("./src/main/resources/res_templates/Modelo 2.docx",
new VariablePattern("#{", "}"));
gen.generateDocument(embargo, "C:\\Documentos\\" + filenames.get(aux) + ".docx");
embargo.setDocDir(filenames.get(aux) + ".docx");
aux++;
}
model.addAttribute("embargos", embargos);
System.out.println("");
} catch (Exception e) {
e.printStackTrace();
}
return "result";
}
最佳答案
解决方案:我删除热部署,我删除下一个依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
关于java - 发现全局预期 com.package.sameobj 的非法类 com.package.sameobj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53676294/
有谁知道蓝牙设备如何获取范围内可发现设备的设备 ID? 理想情况下,我正在寻找涉及蓝牙协议(protocol)最小实现的最简单解决方案。 一个起点会很好,我只是想创建一个设备,它可以以最小的功耗存储附
我有用于搜索Kibana中特定事件的查询,该查询与其他搜索一起保存,是否可以通过REST调用以编程方式更改它? 最佳答案 正如@Mohammad所说,所有与Kibana相关的元数据都存储在elasti
我正在使用带有这些注释的基本集成测试: @ExtendWith(SpringExtension::class) @SpringBootTest(classes = [SomeApplication::
以下是我的代码 HTML: Hello !! Javascript: $(function() { $('#content .child').click(function() {
我试图避免在每个 GDB session 中输入相同的命令。为此,我遵循了 rust discovery book 中的说明。但是当我通过 cargo run 运行程序时,程序没有像书中提到的那样工作
好的,我记得有一些命令可以放在 settings.py 文件中,这样基本上当您将 django 项目移动到另一个目录时,它就不会启动 foo-bar . 我知道我可以通过在它提到主目录的任何地方设置一
假设我正在制作一份注册表单。现在我希望它突出显示四个字段中的空白字段。现在我可以只执行一堆 if-else 语句,但这将花费很长时间。 假设我有以下代码: Javascript: if($firstn
我试图理解 C++ 中 regex 的逻辑 std::string s ("Ni Ni Ni NI"); std::regex e ("(Ni)"); std::smatch sm; std::re
运行时: vim /tmp/blah :q echo $? 我的退出状态为 1 .这破坏了包括 Git 在内的各种东西。如果我在没有 vimrc 的情况下运行 vim: vim -u NONE /tm
我无法通过“查找”来查找旧文件。我将我的发现链接到一个声明中,所有其他部分都运行良好。这是我所拥有的精简版。它搜索 $path 的目录树,并为找到的每个项目创建仅包含换行符的单独临时文件:所有文件、超
我已经多次看到这个问题,但没有一个答案对我有用。 我的 DotNet Core 应用程序失败 编码: public static void Main(string[] args) {
已解决见编辑 2 你好, 我一直在编写一个 Perl 程序来处理本地(专有)程序的自动升级(对于我工作的公司)。 基本上,它通过 cron 运行,不幸的是有内存泄漏(或类似的东西)。问题是泄漏只发生在
在 icCube 中创建到 Oracle 数据库的连接时,“选择现有数据库表”返回一个空的表列表。 连接很好,我可以查询模式创建 SQL 查询。 最佳答案 用户用作模式名称,但 Oracle 使用大写
我正在使用 VBA 循环遍历两个工作表上的行,如果它们匹配,则将工作表 2 中的行复制到工作表 1 中。 我的代码应该: 打开第二个工作簿 将所有信息复制到新工作表上的原始工作簿中 然后循环遍历原始工
当我尝试同步我的数据库时出现这个奇怪的错误: Unhandled rejection Error: Cyclic dependency found. roles is dependent of its
以编程方式发现 perl 模块具有的所有子例程的最佳方法是什么?这可以是一个模块、一个类(没有@EXPORT)或任何介于两者之间的东西。 编辑:下面的所有方法看起来都可以工作。我可能会在生产中使用 C
如何在“讨论”按钮左侧添加“共享”按钮。我希望该按钮与当前的“讨论”按钮具有相同的样式/颜色。 我从https://atmospherejs.com/joshowens/shareit添加了包 我将
我最近从 Netbeans 切换到 Eclipse,Eclipse 在我的项目中发现了许多 Netbeans 没有的语法错误,我不知道为什么。据可以看出,两个 IDE 都设置为使用 java 1.6。
我必须为我的项目设置一些不接受错误网址的规则。我为此使用正则表达式。 我的网址是“http://some/resource/location”。 此网址的开头、中间或结尾不应留有空格。 例如,这些空格
问题:鉴于作为 VMSS 的一部分启动的 N 个实例,我希望每个 Azure 实例上的应用程序代码能够发现其他对等实例的 IP 地址。我该怎么做? 总体目的是对实例进行集群,以提供主动被动 HA 或保
我是一名优秀的程序员,十分优秀!