小编Vid*_*ian的帖子

glassfish 3.1.1导入ssl证书

我正在尝试安装从godaddy.com购买的一些SSL证书.我发现了一些像这样的教程:
http ://www.denizoguz.com/2011/01/02/installing-godaddy-ssl-certificates-on-glassfish-v3-step-by-step/
我的证书是一年生成的以前为apache http服务器,所以我按照第3步中的教程.
我已经在keystore.jks中导入了这些文件,我已经用domain.xml中的证书昵称替换了所有出现的s1as,我已经重新启动了域,但是当我尝试访问ssl上的东西我在glassfish日志中得到这个:

    [#|2011-10-04T16:02:52.972+0300|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=17;_ThreadName=http-thread-pool-8181(1);|GRIZZLY0007: SSL support could not be configured!
java.io.IOException: SSL configuration is invalid due to No available certificate or key corresponds to the SSL cipher suites which are enabled.
        at com.sun.grizzly.util.net.jsse.JSSE14SocketFactory.checkConfig(JSSE14SocketFactory.java:455)
        at com.sun.grizzly.util.net.jsse.JSSE14SocketFactory.init(JSSE14SocketFactory.java:183)
        at com.sun.grizzly.config.SSLConfigHolder.initializeSSL(SSLConfigHolder.java:361)
        at com.sun.grizzly.config.SSLConfigHolder.configureSSL(SSLConfigHolder.java:239)
        at com.sun.grizzly.config.GrizzlyEmbeddedHttps$LazySSLInitializationFilter.execute(GrizzlyEmbeddedHttps.java:202)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:679)
Caused by: javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL cipher suites which …
Run Code Online (Sandbox Code Playgroud)

glassfish glassfish-3

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

Hibernate postgresql通知功能

我正在编写一个使用hibernate + JPA作为ORM和postgresql 9.3作为数据库后端的应用程序,我需要对某些数据库事件做出反应.
更确切地说,我想在将新行插入表中时构建一个使用pg_notify()的触发器.
我已经读过这个,但所有的教程都是直接的jdbc连接,而不是通过hibernate.
我(认为我)不能使用hibernate事件,因为行不是通过hibernate插入的,而是通过第三方应用程序插入的.

有什么方法可以通过hibernate接收通过pg_notify发送的通知吗?

- 更新
现在我有一个classCastException:

java.lang.ClassCastException: com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to org.postgresql.PGConnection
    at com.xxx.core.impl.dao.PostgresqlLowLevelNotificationDAOImpl$1.execute(PostgresqlLowLevelNotificationDAOImpl.java:36)
    at com.xxx.core.impl.dao.PostgresqlLowLevelNotificationDAOImpl$1.execute(PostgresqlLowLevelNotificationDAOImpl.java:1)
Run Code Online (Sandbox Code Playgroud)

我必须提到我使用Glassfish 4.0作为AS.连接池在glassfish上创建,并通过jndi由app访问.此外,EntityManager由容器注入Spring.这是我的代码:

@Named
public class PostgresqlLowLevelNotificationDAOImpl implements PostgresqlLowLevelNotificationDAO{

    @PersistenceContext(type =PersistenceContextType.TRANSACTION,synchronization=SynchronizationType.SYNCHRONIZED,unitName="CCPU")
    private EntityManager em;

@Override
public ArrayList<PGNotification> getNotifications(){

    Session session = em.unwrap(Session.class);

    PGNotification[] notifications = session.doReturningWork(new ReturningWork<PGNotification[]>() {

        @Override
        public PGNotification[] execute(Connection connection) throws SQLException {
            PGNotification[] notifications = ((PGConnection) connection).getNotifications();
            return notifications;
        }

    });

    return (ArrayList) Arrays.asList(notifications);
}   
Run Code Online (Sandbox Code Playgroud)

}

- 更新
我修复了classcast异常:

@Override
public ArrayList<PGNotification> getNotifications(){

    Session session …
Run Code Online (Sandbox Code Playgroud)

java database postgresql hibernate jpa

9
推荐指数
1
解决办法
2628
查看次数

服务器端事件(对于傻瓜:))

我阅读了有关服务器端事件的规范和一些示例/教程,但我现在完全理解整个过程.

如果在使用ajax时,请求 - >响应周期很容易理解,这里看起来有点复杂.如下所述:http://dsheiko.com/weblog/html5-and-server-sent-events,我不明白谁/什么在服务器上生成事件.就像有人不停地调用服务器脚本一样,这就产生了随机数.

不仅如此,作者还说:"此外,您不需要在事件源脚本中应用循环周期.这似乎是将消息自动推送到客户端的重复."
这是怎么回事?

谢谢,

javascript javascript-events

6
推荐指数
1
解决办法
605
查看次数

禁用弹簧自动装配

我有一个struts2.2和春季3.1的应用程序,我想禁用弹簧自动装配.我google了一下,发现我必须放在<beans>标签上default-autowire="no",但这似乎不起作用.

然后我知道我可以为每个<bean>标签声明这个:<bean autowire="no">,但这似乎也不起作用.

当我启用spring debug logger时,我可以看到很多这样的消息:

INFO:DEBUG [http-thread-pool-8080(3)](ConstructorResolver.java:739) - 通过构造函数将bean名称'com.common.actions.PopupAction'的类型自动装配到名为'intermedService'的bean

applicationConfig.xml中的相应条目是:

<beans default-autowire="no" 
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<bean id="PopupAction" scope="prototype" class="com.common.actions.PopupAction" autowire="no">
        <constructor-arg type="com.common.services.abs.iIntermedService" ref="intermedService"/>
        <constructor-arg type="com.common.services.abs.iLocationService" ref="locationService"/>
        <constructor-arg type="com.common.services.abs.iUserService" ref="userService"/>
        <constructor-arg type="com.common.services.abs.iPhoneService" ref="phoneService"/>
    </bean>
Run Code Online (Sandbox Code Playgroud)

为什么春天尝试自动装配这个动作,只要我在这里定义了依赖并且我定义了auto-wire="no"

或者这条消息告诉我接线是通过类型通过构造函数(我想要的)和"按类型自动装配"来表示从4个参数中他将mediumService与我的变量中间服务匹配(而不是按顺序或其他) ?

spring struts2 autowired struts2-spring-plugin

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

Spring Security会话并发

我有一个使用Spring 4.0和Security 3.2的应用程序构建,我想实现会话并发,但它似乎不起作用.安全性的所有其他方面都运行得很好.这是我的xml配置:
首先在我的web.xml中:

<listener>
    <listener-class>
        org.springframework.security.web.session.HttpSessionEventPublisher
    </listener-class>
</listener> 
Run Code Online (Sandbox Code Playgroud)

然后在我的security.xml中

<security:http  auto-config="false" 
                use-expressions="true"
                authentication-manager-ref="authManager"
                access-decision-manager-ref="webAccessDecisionManager"
                entry-point-ref="authenticationEntryPoint">             

    <security:intercept-url pattern="/agent/**" access="hasAnyRole('ROLE_AGENT')" />
    <security:intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" />       
    <security:intercept-url pattern="/public/**" access="permitAll" />
    <security:intercept-url pattern="/**" access="permitAll" />

    <security:session-management session-authentication-strategy-ref="sas"
                                 invalid-session-url="/public/login.xhtml"/>

    <security:logout logout-success-url="/public/login.xhtml" 
                     invalidate-session="true" 
                     delete-cookies="true"/>
    <security:expression-handler ref="webExpressionHandler"/>

    <security:custom-filter position="FORM_LOGIN_FILTER" ref="myAuthFilter" />
    <security:custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
</security:http>
Run Code Online (Sandbox Code Playgroud)

<bean id="authenticationEntryPoint"  class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
    <constructor-arg index="0" value="/public/login.xhtml" />
</bean>

<bean id="customAuthenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"
   p:defaultFailureUrl="/public/login.xhtml" />

<bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/>

 <bean id="concurrencyFilter" class="org.springframework.security.web.session.ConcurrentSessionFilter">
    <constructor-arg index="0" ref="sessionRegistry"/>
    <constructor-arg index="1" value="/session-expired.htm"/>       
</bean>

<bean id="myAuthFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"> …
Run Code Online (Sandbox Code Playgroud)

spring spring-security

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

spring autowire 2 beans发现异常

我有一个spring autowire功能的问题,它找到了两个具有相同类型的bean,但实际上我只有一个bean和这个bean正在实现的接口.

在applicationContext.xml中,我有以下这些行:

<context:component-scan base-package="xxx.vs.services"/>
<context:component-scan base-package="xxx.vs.dao"/>  
<context:annotation-config/> 

<bean id="intermedDao" class="xxx.vs.dao.yyy.IntermedDaoImpl" />
Run Code Online (Sandbox Code Playgroud)

并且:

package xxx.vs.dao.abs.yyy;    
public interface IntermedDao extends GenericDao<Intermed> {
    // methods here
}
Run Code Online (Sandbox Code Playgroud)
package xxx.vs.dao.yyy;    
import org.springframework.stereotype.Repository;
@Repository
public class IntermedDaoImpl extends GenericInboundDaoImpl<Intermed> implements IntermedDao {
    // methods here
}
Run Code Online (Sandbox Code Playgroud)
package xxx.vs.services.yyy;
@Service
@Transactional
public class IntermedServiceImpl implements IntermedService {

    @Autowired
    IntermedDao dao;

    public IntermedDao getDao() {
        return dao;
    }

    public void setDao(IntermedDao dao) {
        this.dao = dao;
    }    
}
Run Code Online (Sandbox Code Playgroud)

使用此配置我得到:

java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 
org.springframework.beans.factory.BeanCreationException: Error …
Run Code Online (Sandbox Code Playgroud)

spring

0
推荐指数
1
解决办法
4690
查看次数