小编Mah*_*leh的帖子

对话框架不起作用

我正在尝试应用基本示例在对话框中呈现页面,如展示页面 http://www.primefaces.org/showcase/ui/dialogFrameworkBasic.jsf

  • 我的网页在webapp/pages/general下
  • 我在Mojarra-2.1.20上运行PrimeFaces-4.0-SNAPSHOT
  • 我有两页:1- home.xhtml 2- viewreport.xhtml

1- home.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:p="http://primefaces.org/ui"
    xmlns:pretty="http://ocpsoft.com/prettyfaces"
    xmlns:sec="http://www.springframework.org/security/tags"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>


    <title>Welcome</title>
    <h:outputStylesheet library="css" name="style.css" />
</h:head>

<h:body dir="rtl">

    <h:form>
        <p:commandButton value="View" icon="ui-icon-extlink"
            action="dialog:viewreport" />
    </h:form>

</h:body>

</html>
Run Code Online (Sandbox Code Playgroud)

2- viewreport.xhtml:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>

<h:body>
    <h:panelGroup id="report_details_new" layout="block" style="width:500px;height:500px;">

      HELLO WORLD


    </h:panelGroup>
   </h:body>

   </html>
Run Code Online (Sandbox Code Playgroud)

当点击按钮时,没有任何反应,我在eclipse控制台或浏览器控制台中没有任何错误.

请告知对话框架无效的原因.

primefaces jsf-2

5
推荐指数
1
解决办法
2905
查看次数

org.hibernate.PersistentObjectException:在内存数据库中传递给H2持久化的分离实体

我在内存数据库中使用H2进行测试,我的配置如下:

1- SpringTestingConfig:

@Configuration
@ComponentScan(basePackages = "com.myapp.data", excludeFilters = { @Filter(Configuration.class) })
@PropertySource("classpath:/test.properties")
@Profile("test")
public class SpringTestingConfig {
   @Bean
   public DataSource dataSource() {
      DriverManagerDataSource dataSource = new DriverManagerDataSource();
      dataSource.setDriverClassName("org.h2.Driver");
      dataSource.setUrl("jdbc:h2:mem:test;MODE=Mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS MYAPP");
      dataSource.setUsername("sa");
      dataSource.setPassword("");
      return dataSource;
   }
}
Run Code Online (Sandbox Code Playgroud)

2- MyTestClass:

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ WebContextTestExecutionListener.class,
        DependencyInjectionTestExecutionListener.class,
        DirtiesContextTestExecutionListener.class,
        TransactionalTestExecutionListener.class })
@ActiveProfiles("test")
@DirtiesContext
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {
        SpringConfig.class, SpringTestingConfig.class,
        SpringLocalContainerJPAConfig.class, CustomConfiguration.class })
@PrepareForTest({ FacesContext.class })
@PowerMockIgnore({ "javax.management.*", "javax.xml.parsers.*",
    "com.sun.org.apache.xerces.internal.jaxp.*", "ch.qos.logback.*",
    "org.slf4j.*" })
public class MyTestClass{

   private Company company;
   private …
Run Code Online (Sandbox Code Playgroud)

spring hibernate jpa h2 spring-data

5
推荐指数
1
解决办法
2万
查看次数

java.lang.UnsatisfiedLinkError:java中没有ocijdbc11.library.path

我试图让JDBC OCI连接到的Oracle 11g使用OS验证

我做了一个示例控制台应用程序来测试某些客户端计算机上的连接

我在具有jdk 6的机器上开发了应用程序,并在项目中使用了jar ojdbc6.jar.

我用来连接数据库的代码如下:

OracleDataSource ods = new OracleDataSource();
String tnsName="Prod";
ods.setURL("jdbc:oracle:oci:/@"+tnsName);
Connection conn = ods.getConnection();
Run Code Online (Sandbox Code Playgroud)

我正在尝试从安装了oracle11g的客户端计算机上运行此应用程序,并且在路径上将oracle主目录设置为: C:\ orant\jdk\bin

路径:C:\ orant\bin包含oci.dll,不包含ocijdbc11.dll

客户端安装了jre7并且没有jdk.

当试图在os验证到oracle数据库的客户端机器上运行上面的代码时,我遇到以下异常:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.
library.path
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3178)
        at java.security.AccessController.doPrivileged(Native Method)
        at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java
:3174)
        at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:233)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
508)
        at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133)
        at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtensio
n.java:53)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
        at …
Run Code Online (Sandbox Code Playgroud)

java oracle jdbc oracle-call-interface

5
推荐指数
1
解决办法
4万
查看次数

JMeter:如何查找java.net.SocketTimeoutException的原因?

我正在为我的 Web 应用程序进行负载测试,并将连接超时和响应超时设置为 20 秒,有时我会遇到如下异常:

非 HTTP 响应代码:java.net.SocketTimeoutException:非 HTTP 响应消息:读取超时

我在 JMeter 测试结果中得到上述异常,并且我的应用程序中没有抛出任何错误,并且没有堆栈跟踪可用于跟踪异常。

我想找出该消息的原因:应用程序是否正在等待处理某些内容,或者 SQL 速度较慢,或者线程挂起,或者应用程序因为已满而拒绝连接?

我怎样才能找到抛出此异常的原因,以及如何修复它?

java testing jmeter load-testing socket-timeout-exception

5
推荐指数
1
解决办法
2万
查看次数

如何从xml请求中删除xmlns =""

我正在使用CXF 3.0.8来调用Web服务:

@WebService(targetNamespace = "http://tempuri.org/", name = "INotificationGateway")
@XmlSeeAlso({ObjectFactory.class, com.microsoft.schemas._2003._10.serialization.ObjectFactory.class, org.datacontract.schemas._2004._07.notificationsgateway.ObjectFactory.class, com.microsoft.schemas._2003._10.serialization.arrays.ObjectFactory.class})
public interface INotificationGateway {

    @WebResult(name = "SendSMSResult", targetNamespace = "http://tempuri.org/")
    @Action(input = "http://tempuri.org/INotificationGateway/SendSMS", output = "http://tempuri.org/INotificationGateway/SendSMSResponse", fault = {@FaultAction(className = INotificationGatewaySendSMSEAICustomErrorFaultFaultMessage.class, value = "http://tempuri.org/INotificationGateway/SendSMSEAICustomErrorFault")})
    @RequestWrapper(localName = "SendSMS", targetNamespace = "http://tempuri.org/", className = "org.tempuri.SendSMS")
    @WebMethod(operationName = "SendSMS", action = "http://tempuri.org/INotificationGateway/SendSMS")
    @ResponseWrapper(localName = "SendSMSResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.SendSMSResponse")
    public org.datacontract.schemas._2004._07.notificationsgateway.NotificationResponse sendSMS(
        @WebParam(name = "SendSMSNotificationRequest")
        org.datacontract.schemas._2004._07.notificationsgateway.SendSMSNotificationRequest sendSMSNotificationRequest
    ) throws INotificationGatewaySendSMSEAICustomErrorFaultFaultMessage;

}
Run Code Online (Sandbox Code Playgroud)

我在服务请求中发送的对象是:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SendSMSNotificationRequest", propOrder …
Run Code Online (Sandbox Code Playgroud)

java soap web-services cxf jaxb

5
推荐指数
1
解决办法
982
查看次数

当我的Web应用程序处于空闲状态时,独立的tomcat 9每10秒就会将CPU上升到50%

我在Windows Server 2012 R2上使用Tomcat 9.0.0.M22和jdk1.8.0_131并且我在其上部署了一个Spring Boot Web应用程序,问题是,每隔10秒,commons守护程序服务运行程序将CPU增加到50%,尽管我部署的Web应用程序处于空闲状态,然后降低到0%,并且此行为每10秒继续发生一次.

在我的应用程序中,我没有任何每10秒运行一次的工作,而且当我从Eclipse运行我的Web应用程序时,我没有注意到相同的行为,所以我猜这是一个内置线程的Tomcat.

java tomcat cpu-usage windows-server-2012-r2 tomcat9

5
推荐指数
1
解决办法
756
查看次数

oauth2 身份验证成功并获得匿名令牌后收到 404

我将 oauth2 与springboot 1.5.6.RELEASE一起使用,并且将 jdbc 身份验证与 oauth2 一起使用。

\n\n

我添加了属性:security.oauth2.resource.filter-order = 3

\n\n

1-授权服务器配置适配器:

\n\n
@Configuration\n@EnableAuthorizationServer\npublic class OAuth2Config extends AuthorizationServerConfigurerAdapter {\n\n    @Autowired\n    @Qualifier("authenticationManagerBean")\n    @Lazy\n    private AuthenticationManager authenticationManager;\n\n    @Autowired\n    private Environment env;\n\n    @Override\n    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {\n\n        // endpoints.tokenStore(tokenStore()).authenticationManager(authenticationManager);\n        endpoints.authenticationManager(authenticationManager);\n    }\n\n    @Bean\n    public TokenStore tokenStore() {\n        return new JdbcTokenStore(dataSource());\n    }\n\n    @Override\n    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {\n        security.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()");\n    }\n\n    @Override\n    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {\n        clients.jdbc(dataSource());\n    }\n\n    @Bean\n    public DataSource dataSource() {\n …
Run Code Online (Sandbox Code Playgroud)

spring-security oauth-2.0 spring-boot spring-security-oauth2 spring-oauth2

5
推荐指数
1
解决办法
5853
查看次数

同一属性上的不同 Hibernate 验证注释

我在 bean 中的属性上使用两个验证注释:

@NotEmpty(message = "{name.required}")
@Pattern(regex = "^([A-Za-z0-9]{2,}(\\-[a-zA-Z0-9])?)$", message = "{invalid.name}")
private String name;
Run Code Online (Sandbox Code Playgroud)

如果我将名称留空,则会出现两个错误,但我只想要第一个错误消息(如果出现第一个条件,则显示其错误消息,然后跳过第二个条件)。

hibernate hibernate-validator

4
推荐指数
1
解决办法
2857
查看次数

如何在spring框架中编码url?

问候我在控制器中有一个post方法,它重定向到一个新的页面我喜欢这样的方式:

@RequestMapping(method = RequestMethod.POST)
    public String post(HttpServletRequest request) {

        return "redirect:http://www.x.appName.com/myPage";

    }
Run Code Online (Sandbox Code Playgroud)

假设用户在重定向之前已经有一个会话,并且我想在重定向之前对新url进行编码以维护用户会话如何执行此操作?

java spring servlets spring-mvc spring-security

4
推荐指数
1
解决办法
7166
查看次数

javax.el.E​​LException:标识符[return]不是有效的Java标识符

我有一个页面网址,看起来像:

http://mydomain.com/nodes/32/article/new?return=view

安装tomcat 7后,在尝试访问它时,我遇到了这个异常:

/nodes/${param.id}/article/new?return=${param.return}
contains invalid expression(s): javax.el.ELException: The identifier [return] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
Run Code Online (Sandbox Code Playgroud)

任何想法为什么我得到它?要解决它,我应该只在tomcat中更改此属性吗?

java-ee tomcat7

4
推荐指数
1
解决办法
8889
查看次数