JNDI名称有什么用?我正在尝试使用Java 5的新注释功能获取javax.sql.DataSource.它对我不起作用,所以我想问...
我在我的web.xml中,里面是一个元素.我在"jdbc/MyDB"和"MyDB"之间切换.既没有使我的基于类的DataSource工作(它总是为null),但在另一个我使用taglib创建的例子中,这两个JNDI名称都有效.
所以我按照"从头开始验证"的轨道进行了操作 - http://railscasts.com/episodes/250-authentication-from-scratch
我知道rails 4不使用attr_accessible.我在我的用户控制器中将user_params定义为私有方法.出于某种原因,rails给了我一个用户参数的未定义错误.我正在开发另一个rails应用程序,我检查了它中的post控制器.除了工作之外,它完全一样.知道这里的问题是什么吗?
users_controller.rb
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.create(user_params)
if @user.save
redirect_to root_url, :notice => "Signed up!"
else
render "new"
end
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
Run Code Online (Sandbox Code Playgroud)
错误消息:未定义的局部变量或方法`user_params'for#
完整堆栈跟踪:
app/controllers/
create' actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:4:inusers_controller.rb :7:在send_action'actionpack(4.1.1)lib/abstract_controller/base.rb:189:inprocess_action' actionpack (4.1.1) lib/action_controller/metal/rendering.rb:10:inprocess_action'actionpack(4.1.1)lib/abstract_controller/callbacks.rb:20:inblock in process_action' activesupport (4.1.1) lib/active_support/callbacks.rb:113:incall 'activesupport(4.1.1)lib/active_support/callbacks.rb:113:在call' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in块中停止'activesupport(4.1.1)lib/active_support/callbacks.rb:229:在call' activesupport (4.1.1) lib/active_support/callbacks.rb:229:in块中停止'activesupport(4.1.1)lib /active_support/callbacks.rb:166:incall' activesupport (4.1.1) lib/active_support/callbacks.rb:166:in阻止'activesupport(4.1.1)lib/active_support/callbacks.rb:166:在call' activesupport …
对于访问非liferay Oracle数据库的Liferay 6.2自定义portlet,我们遇到的问题是返回的数据源为null.
我们已经配置了tomcat/conf/context.xml
<!-- Adding custom New non liferay datasource -->
<Resource name="jdbc/NewPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbservernameorip)(PORT = 9999))
(CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = dbSIDorservicename)))"
username="user"
password="pwd"
maxActive="35"
maxIdle="10"
maxWait="20000"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="3600000"
timeBetweenEvictionRunsMillis="1800000"
testOnBorrow="true"
testOnReturn="false"
/>
Run Code Online (Sandbox Code Playgroud)
portlet web.xml包含:
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/NewPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Run Code Online (Sandbox Code Playgroud)
查找代码是:
String JNDI = "jdbc/NewPool"
_log.debug("JNDI Name is: " + JNDI);
_log.debug("dataSource in dbConnect is :" + dataSource);
Context context = new …Run Code Online (Sandbox Code Playgroud) 以下是我的 database.yml
development:
adapter: postgresql
host: localhost
encoding: unicode
database: pepe_development
pool: 5
username: pepe
password: password
template: template0
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我得到以下信息 db:migrate
smaringanti-mbp:xpm smaringanti$ rake db:migrate 警告:在 Figaro 配置中使用字符串。["admin", "user", "VIP"] 被转换为 "[\"admin\", \"user\", \"VIP\"]"。耙子中止!ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: 错误:权限被拒绝关系 schema_migrations : SELECT "schema_migrations".* FROM "schema_migrations" /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/ activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in
async_exec' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:inexec_no_cache' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib /active_record/connection_adapters/postgresql/database_statements.rb:138:inblock in exec_query' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in阻止日志'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:inlog' /Users/ smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:inexec_query' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:891:inselect'/Users/smaringanti/.rvm/ gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:24:inselect_all' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:inselect_all' /Users/smaringanti/.rvm/gems/ruby-2.0 .0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/querying.rb:36:infind_by_sql' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:585:inexec_queries'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/ activerecord-4.0.2/lib/active_record/relation.rb:471:inload' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:220:into_a' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:12:inmap' /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:inget_all_versions' /Users/smaringanti/ …
postgresql ruby-on-rails localhost database-migration ruby-on-rails-4
我在Linux redhad设置上有一个带有apache 1.3(启用了SSL)+ mod_jk + tomcat 5.5的网站.就在最近,我的网站开始出现停机问题.每天一次,我的网站挂在端口80上.但如果我通过8080 tomcat直接访问响应和网站工作正常.80和8080端口都可以访问,但与mod_jk的apache和tomcat连接断开.只有在我重新启动tomcat之后,事情才恢复正常.
我刚刚配置了apache mod_Jk来记录错误,所以我会看到下次挂起时是否会有任何错误.
apache mod_js conf:
JkShmSize 1000M
Run Code Online (Sandbox Code Playgroud)
阿帕奇工人conf:
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.socket_keepalive=1
worker.worker1.recycle_timeout=180
worker.worker1.sticky_session=False
Run Code Online (Sandbox Code Playgroud)
我检查了tomcat上的web应用程序错误/警告日志,我有一些"内存不足"的java异常.应用程序错误会导致此问题吗?是网站过载问题还是内存泄漏?目前dev/mapper/VolGroup00-LogVol00只有4%的可用空间.这可能是问题的原因吗?
我也有这个日志条目,它匹配服务器挂起时间:
/ var/log/messages:端口8009上可能的SYN泛洪.发送cookie
更新: 我刚刚收到另一个,mod_jk日志给出了这个:
[Sun Nov 14 00:57:03 2010] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is$
[Sun Nov 14 00:57:03 2010] [error] ajp_get_reply::jk_ajp_common.c (1503): Tomcat is down or refused connection. No response has been sent to the client (yet)
[Sun Nov 14 00:57:08 2010] …
在Liferay 6.0插件MVC portlet中,如何从portlet类访问portlet配置?
请注意,"配置"我的意思是特定于portlet的一个实例,并且是值不是用户特定的; 如果管理员设置了portlet配置值,它应该对所有用户生效.
例如:
public class MyPortlet extends MVCPortlet
{
@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException
{
// Fill in the blank; what goes here?
String configValue = ?;
renderRequest.setAttribute("some-key", configValue);
super.doView(renderRequest, renderResponse);
}
}
Run Code Online (Sandbox Code Playgroud) 在JS控制台上玩我遇到了一种奇怪的语法.我想知道是否有人可以告诉我更多...
试试这个:
>( function f(){console.log('i am f')} , (function x(){console.log('i am x')})() , y=2 , console.log('hello') )
i am x
hello
undefined
>f()
ReferenceError: f is not defined
>this.y
2
Run Code Online (Sandbox Code Playgroud)
这将失败:
(var c = 2)SyntaxError:意外的令牌变量
因此评估括号内的逗号分隔表达式,赋值碰巧是针对全局范围的,但命名函数声明引用仍然被困在内部,就像一个闭包更多......将该行放入一个用new调用的函数声明中:
function C(){
( function f(){console.log('i am f')} , (function x(){console.log('i am x')})() , y=2 , console.log('hello') )
}
Run Code Online (Sandbox Code Playgroud)
然后实例化:
>var c=new C()
i am x
hello
undefined
>c.y
undefined
>this.y
2
Run Code Online (Sandbox Code Playgroud)
发生完全相同,就像在全球范围内执行一样!
这个结构的用途/目的是什么?
多一个:
>( function f(){console.log('i am f')} , f() ) …Run Code Online (Sandbox Code Playgroud) 我已经开始学习Rails了,而且我第9章第三次练习了.
该演习看起来是这样的:
test "should not allow the admin attribute to be edited via the web" do
log_in_as(@other_user)
assert_not @other_user.admin?
patch :update, id: @other_user, user: { password: FILL_IN,
password_confirmation: FILL_IN,
admin: FILL_IN }
assert_not @other_user.FILL_IN.admin?
end
Run Code Online (Sandbox Code Playgroud)
我的问题是last Fill_IN >> assert_not @other_user.FILL_IN.admin?
@other_user 取自Fixture,看起来像这样:
archer:
name: Sterling Archer
email: duchess@example.gov
password_digest: <%= User.digest('password') %>
Run Code Online (Sandbox Code Playgroud)
Update action 看起来像这样:
def update
@user = User.find(params[:id])
if @user.update_attributes(user_params)
flash[:success] = "Profile updated"
redirect_to @user
else
render 'edit'
end
end
Run Code Online (Sandbox Code Playgroud)
我还添加:admin到user_params所以 …
我要求:
您的请求已成功处理
可能吗?有没有办法显示成功或失败的消息?
<%@page import ="javax.portlet.PortletURL" %>
<%@ page import="javax.portlet.RenderResponse" %>
<%@ page import="javax.portlet.ActionRequest" %>
<%@ page import="com.liferay.portal.kernel.util.Validator" %>
<%
PortletURL searchCourseURL=renderResponse.createActionURL();
searchCourseURL.setParameter(ActionRequest.ACTION_NAME,"findCourses");
%>
<script type="text/javascript" src="/html/js/jquery/jquery.js"></script>
<form action="<%=searchCourseURL%>" method="post">
<div class="label1">Enter Course Name</div><input type="text" id="cname" name="cname" value=" "/>
<input type="submit" name="submit" value="Submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,在提交请求后,它显示请求过程成功,而我必须显示消息:
搜索完成
我是新来的。
试图运行spark on yarn in yarn-client mode。
SPARK VERSION = 1.0.2 HADOOP VERSION = 2.2.0
纱线簇具有3个活动节点。
在spark-env.sh中设置的属性
SPARK_EXECUTOR_MEMORY = 1G
SPARK_EXECUTOR_INSTANCES = 3
SPARK_EXECUTOR_CORES = 1
SPARK_DRIVER_MEMORY = 2G
使用的命令:/ bin / spark-shell --master yarn-client
但是登录后spark-shell,它只注册了1个执行程序,并为其分配了一些默认的内存。
我也通过spark-web UI它确认了它只有1个执行器,并且也YARN resource manager node仅在主节点()上。
INFO yarn.Client:用于启动Spark Application的命令主:列表($ JAVA_HOME / bin / java,-server,-Xmx2048m,-Djava.io.tmpdir = $ PWD / tmp,-Dspark.tachyonStore.folderName = \“ spark- fc6383cc-0904-4af9-8abd-3b66b3f0f461 \“,-Dspark.yarn.secondary.jars = \” \“,-Dspark.home = \” / home / impadmin / spark-1.0.2-bin-hadoop2 \“, -Dspark.repl.class.uri …
java ×2
jndi ×2
liferay-6 ×2
portlet ×2
ajp ×1
apache ×1
apache-spark ×1
closures ×1
datasource ×1
hadoop ×1
hadoop-yarn ×1
java-ee ×1
javascript ×1
liferay ×1
localhost ×1
mod-jk ×1
oracle ×1
plugins ×1
postgresql ×1
scala ×1
scope ×1
tomcat ×1
tomcat6 ×1
tomcat7 ×1