更新:显然Tomcat,从7.0.11开始,为您关闭DataSource,因此它在webapp的contextDestroyed中不可用.请参阅:https://issues.apache.org/bugzilla/show_bug.cgi?id = 25060
嗨,
我正在使用Spring 3.0和Java 1.6.
如果我以这种方式获得数据源:
<bean id="dataSource" class="my.data.Source" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:home"/>
<property name="username" value="user"/>
<property name="password" value="pw"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
然后在bean被销毁时关闭数据源.
如果我得到这样的数据源:
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/db" />
Run Code Online (Sandbox Code Playgroud)
那么我是否必须在contextDestroyed监听器中显式关闭数据源?
谢谢,
保罗
我有一个应用程序,要求我在反向代理中禁用缓冲.我设法使用以下nginx配置:
server {
listen 80;
server_name 10.0.0.104;
location / {
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://http_backend;
proxy_redirect default;
}
}
upstream http_backend {
server 10.0.0.86:8080;
keepalive 16;
}
Run Code Online (Sandbox Code Playgroud)
我需要在Apache上使用相同的设置,但apache没有proxy_buffering off指令.我能够在mod_proxy文档中找到的唯一配置是ProxyIOBufferSize,ProxyReceiveBufferSize但它们具有最小值而不是禁用缓冲的选项.我测试了那些,但我的应用程序失败了.
我有以下设置
1.liferay集群,在AWS上有2台机器
2.通过tcp与JGroups进行单播集群复制
我在portal-ext.properties中有以下参数
#Setup hibernate
net.sf.ehcache.configurationResourceName=/myehcache/hibernate-clustered.xml
#Setup distributed ehcache
ehcache.multi.vm.config.location=/myehcache/liferay-multi-vm-clustered.xml
#
# Clustering settings
#
cluster.link.enabled=true
ehcache.cluster.link.replication.enabled=true
cluster.link.channel.properties.control=tcp.xml
cluster.link.channel.properties.transport.0=tcp.xml
lucene.replicate.write=true
#In order to make use of jgroups
ehcache.bootstrap.cache.loader.factory=com.liferay.portal.cache.ehcache.JGroupsBootstrapCacheLoaderFactory
ehcache.cache.event.listener.factory=net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory
ehcache.cache.manager.peer.provider.factory=net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory
net.sf.ehcache.configurationResourceName.peerProviderProperties=file=/myehcache/tcp.xml
ehcache.multi.vm.config.location.peerProviderProperties=file=/myehcache/tcp.xml
cluster.executor.debug.enabled=true
ehcache.statistics.enabled=true
Run Code Online (Sandbox Code Playgroud)
我无法使群集缓存复制正常工作.任何人都可以指出正确的方向吗?如果以后需要,我可以发布更多细节.我还试图修改hibernate-clustered.xml和liferay-multi-vm-clustered.xml,但没有任何作用.
好吧,对不起,如果这是一个愚蠢的问题,但我正在尝试使用Node.js进行NTLM身份验证.我一直在读这篇文章(http://davenport.sourceforge.net/ntlm.html#theNtlmMessageHeaderLayout).我发送标头并获得Base64身份验证标头.
我尝试通过使用base64编码创建一个新的Buffer然后调用toString('utf8')返回类似的字符串,将它从Base64转换为UTF8
NTLMSSP\u0000\u0001\u0000\u0000\u0000\u0007�\b�\u0000
这是我需要帮助的地方.我理解NTLMSSP\u0000是空终止签名,但是其余的应该表明什么,但对我来说它只是垃圾.它是unicode字符,但我怎么能从中得到实际数据呢?我可能会错误地转换它,这可能会增加我的麻烦,但我希望有人可以提供帮助.
Hy all,
我是Liferay的新手,我从jsp到Liferay门户网站进行了一些移植.
如果我有一个portlet jsp,其中包含两个日期:FromDate ToDate并使用两个不同的liferay-ui:input-date为每个日期字段,如:
...
<%-- From DATE --%>
<tr>
<td>
From date :
</td>
<td>
<liferay-ui:input-date
dayParam='<%= "strDataRegDa" + "Day" %>'
dayValue="<%=Integer.parseInt(strDataRegDa.substring(0,2))%>"
dayNullable="<%= false %>"
monthParam='<%= "strDataRegDa" + "Month" %>'
monthValue="<%=(Integer.parseInt(strDataRegDa.substring(3,5))) -1 %>"
monthNullable="<%= false %>"
yearParam='<%= "strDataRegDa" + "Year" %>'
yearValue="<%=Integer.parseInt(strDataRegDa.substring(6))%>"
yearNullable="<%= false %>"
yearRangeStart="<%= 1980 %>"
yearRangeEnd="<%= 2050 %>"
firstDayOfWeek="<%= Calendar.MONDAY - 1 %>"
imageInputId='<%= "ceremonyDate"%>'
disabled="false" >
</liferay-ui:input-date>
</td>
</tr>
<%-- To DATE --%>
<tr>
<td>
To date :
</td>
<td>
<liferay-ui:input-date
dayParam='<%= "strDataRegA" …Run Code Online (Sandbox Code Playgroud) class TicketsController < ApplicationController
before_action :set_project
before_action :set_ticket, only: [:show, :edit, :update, :destroy]
def show
end
def set_ticket
@ticket = @project.tickets.find(params[:id])
end
def set_project
@project = Project.for(current_user).find(params[:project_id])
rescue ActiveRecord::RecordNotFound
flash[:alert] = "The project you were looking " +"for could not be found."
redirect_to root_path
end
end
Run Code Online (Sandbox Code Playgroud)
项目的模板- show.html.erb
<% @project.tickets.each do |ticket| %>
<li>
#<%= ticket.id %> - <%= link_to ticket.title, [@project, ticket] %>
</li>
<% end %>
Run Code Online (Sandbox Code Playgroud)
我收到错误:uninitialized constant Project::Ticket显示模板的第一行
这是在我的路由文件中
resources :projects do
resources :tickets
end …Run Code Online (Sandbox Code Playgroud) 我想知道如何配置我的 httpd 服务器来提供以下页面:
当 url 为 /context/static 时,我需要提供位于我的 /var/www/static 中的静态内容,并将其余内容代理到 tomcat 服务器
按照这个顺序:
/context/static/* --> files served by httpd
/context/* --> resources served by tomcat
Run Code Online (Sandbox Code Playgroud)
我试图将 /context/static/* 重写为指向我的 /var/www/static 的文件夹,并ProxyPath为其余部分添加了指令,但我无法让它工作。
什么是最佳实践以及如何实现?
提前致谢
我使用 Apache HTTP Server mod_proxy 作为我的客户端和服务器之间的代理服务器。我能够从我的客户端连接到我的代理服务器。然后客户端能够建立连接并将数据发送到服务器。但在中间,某处连接丢失,并给出以下错误:
(OS 10054)An existing connection was forcibly closed by the remote host. : proxy: prefetch request body failed to 10.131.x.x:80 (10.131.x.x) from 10.131.y.y ()
Run Code Online (Sandbox Code Playgroud)
我曾尝试添加 keep alive 和其他属性,但它没有解决我的问题。这是我的 httpd.config 文件更改:
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<IfModule mod_proxy.c>
ProxyRequests On
ProxyVia On
</IfModule>
<Proxy *>
Order deny,allow
Deny from all
Allow from 10.131.x.x
</Proxy>
Run Code Online (Sandbox Code Playgroud)
还添加了这个变量:
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15
Listen 8080
Run Code Online (Sandbox Code Playgroud)
请需要知道是否有人遇到过同样的问题并解决了它。
谢谢,阿林达姆。
我正在尝试设置一个Ubuntu Docker容器,它在端口9000上运行Node.js HTTP应用程序.为了模仿生产环境的设置,我还希望将Apache作为一个简单的反向代理服务器运行在容器中,转发给它来自端口80的应用程序(我向大坏世界揭露).
我已经能够很好地设置Node.js应用程序容器了,我可以在我的内部安装和设置Apache Dockerfile; 但我对设置反向代理完全不熟悉,所以当Apache确实启动时,它不会代理.
我Dockerfile看起来像:
# DOCKER-VERSION 1.3.0
FROM ubuntu:12.04
# Install and set up Apache as a reverse proxy
RUN apt-get -y install apache2 libapache2-mod-proxy-html
COPY apache2.conf /etc/apache2/app.conf
RUN cat /etc/apache2/app.conf >> /etc/apache2/apache2.conf
RUN service apache2 start
# Install and set up Node.js and bundle app
# ...This works...
EXPOSE 80
CMD ["./start-app.sh"]
Run Code Online (Sandbox Code Playgroud)
...... apache2.conf我追加的/etc/apache2/apache2.conf是:
ServerName localhost
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
<Proxy *> …Run Code Online (Sandbox Code Playgroud) 我正在使用rails 4进行图像上传,但是我有问题让它工作.
undefined method `remove_previously_stored_files_after_update' for #<ActionDispatch::Http::UploadedFile:0x0000000d3f7778>
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
以下是完整的跟踪:
carrierwave(0.10.0)lib/carrierwave/mount.rb:233:在
store_previous_model_for_image' activesupport (4.2.3) lib/active_support/callbacks.rb:430:inmake_lambda 中的 块'activesupport(4.2.3)lib/active_support/callbacks.rb:162:在call' activesupport (4.2.3) lib/active_support/callbacks.rb:162:in块中停止'activesupport(4.2.3)lib/active_support/callbacks.rb:502:在call' activesupport (4.2.3) lib/active_support/callbacks.rb:502:in调用块中'activesupport(4.2.3)lib/active_support/callbacks.rb:502:在each' activesupport (4.2.3) lib/active_support/callbacks.rb:502:in调用'activesupport(4.2.3)lib/active_support/callbacks.rb:88:inrun_callbacks' activerecord (4.2.3) lib/active_record/callbacks.rb:310:in_update_record 'activerecord(4.2.3)lib/active_record/timestamp.rb:70:in_update_record' activerecord (4.2.3) lib/active_record/persistence.rb:504:increate_or_update'activerecord(4.2.3)lib/active_record/callbacks.rb:302:inblock in create_or_update' activesupport (4.2.3) lib/active_support/callbacks.rb:115:incall'activesupport(4.2.3)lib/active_support/callbacks .rb:115:在call' activesupport (4.2.3) lib/active_support/callbacks.rb:553:in编译中的块(2级)'activesupport(4.2.3)lib/active_support/callbacks.rb:503:incall' activesupport (4.2.3) lib/active_support/callbacks.rb:503:in调用'activesupport(4.2.3)lib/active_support/callbacks.rb:88:inrun_callbacks' activerecord (4.2.3) lib/active_record/callbacks.rb:302:increate_or_update'activerecord(4.2.3)lib/active_record/persistence.rb:120:在save' activerecord (4.2.3) lib/active_record/validations.rb:37:insave'activerecord(4.2.3)lib/active_record/attribute_methods/dirty.rb:21:在save' activerecord (4.2.3) lib/active_record/transactions.rb:286:inblock(2级)中保存'activerecord( 4.2.3)lib/active_record/transactions.rb:351:在block in …
apache ×4
mod-proxy ×4
httpd.conf ×2
node.js ×2
carrierwave ×1
datasource ×1
docker ×1
ehcache ×1
encoding ×1
httpserver ×1
javascript ×1
jgroups ×1
jndi ×1
jsp ×1
liferay ×1
liferay-6 ×1
mod-rewrite ×1
nginx ×1
ntlm ×1
proxy ×1
replication ×1
spring ×1
spring-jdbc ×1
tomcat7 ×1