你知道一些好的线程转储分析工具吗?完美将是:
编辑:
编辑: 我的选择是:武士.它具有我需要的所有功能:加载日志文件,并比较几个线程转储.分析它并指出:
我会回答问题,因为TDA是给出的最佳答案.
我在Glassfish 3上运行JavaEE 6 Web应用程序.我使用JAAS和jdbcRealm以及默认主体到角色映射.在我的数据库中,我有用于将用户名映射到其角色的表:
username | role
----------+-------
john | admin
mary | user
Run Code Online (Sandbox Code Playgroud)
为什么我需要再次在我的列表中列出这些角色web.xml?
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
Run Code Online (Sandbox Code Playgroud)
没有它isUserInRole()总是返回false.
我已准备好将我们的posgresql数据库移至EC2,但我对最佳备份和恢复策略有点不清楚.最初的计划是构建一个EBS支持的服务器,设置WAL-E来处理WAL归档和基本备份到S3.如果实例崩溃,我会拍摄最终生产服务器卷的快照.我还看到很多人为了恢复目的而频繁执行EBS快照.
推荐的策略是什么?是否有理由使用WAL存档并执行预定的EBS快照?
我想针对Maven Eclipse项目运行Fortify扫描.
我应该从哪里开始?
我知道我需要更新我的pom.xml文件以包含Fortify插件,但是我还需要在我的机器上安装Fortify SCA吗?(我正在运行MacOS X).我一直试图找到一个下载Fortify SCA的地方,但一直找不到它.
我很感激,如果有人可以分享一些链接,指出我在正确的方向上完成设置.
我厌倦了所有这些无聊的样板代码来解析应用程序配置,如数据库连接,工作目录,API端点等等.Spring IoC看起来不错,但这会强制我的应用程序的用户修改XML文件,只是为了编辑数据库URL等等.这也可能在XML文件中非常分散,其中所有其他布线都会出现问题.
允许最终用户配置服务(不在应用程序服务器内运行)的最佳技术是什么?你们用的是什么?
这是我的mvc-config.xml的片段:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:view-controller path="/index" view-name="welcome"/>
<mvc:view-controller path="/static/login" view-name="/static/login"/>
<mvc:view-controller path="/login" view-name="/static/login"/>
Run Code Online (Sandbox Code Playgroud)
我在/ WEB-INF/view /目录下有welcome.jsp,在/ WEB-INF/view/static /上有login.jsp.
这适用于'/ index'和'/ login'路径.但是当我从浏览器调用时,我得到了'/ static/login'的404响应.我期待'/ static/login /'和'/ login'的行为应该相同.
这可能有什么问题?
非常感谢任何帮助.
谢谢!
这是web.xml:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<!-- Enables clean URLs with JSP views e.g. /welcome instead of /app/welcome -->
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Handles all …Run Code Online (Sandbox Code Playgroud) 最近我了解到,如果只进行一次更改并调用merge,则默认的hibernate行为是更新对象中的所有字段.
动态更新是允许您配置仅更新已更改字段的替代方法的字段...
http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/
我正在使用JPA与hibernate,我试图添加以下内容
@javax.persistence.Entity
@org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate=true)
Run Code Online (Sandbox Code Playgroud)
到我的班级(之前它只有JPA注释)
无论如何,我一直在监视sql,不幸的是它没有改变它,我仍然看到每个字段都更新.
这是我更新对象的java ...
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void setAccountStatusForUser(String username, AccountStatus act){
User u = this.getUser(username);
u.setAccountStatus(act);
this.update(u);
}
Run Code Online (Sandbox Code Playgroud)
并且update方法执行以下操作:
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public Object update(Object o) {
Object a = this.entityManager.merge(o);
this.entityManager.flush();
return a;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我正在使用hibernate开发一个项目.我有这两个文件:
Persoon.java
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "PROJ_TYPE")
@Table(name = "PROJECT")
public class Persoon {
@Id
@GeneratedValue
protected int persoonsnummer;
protected String voornaam;
protected String achternaam;
protected String adres;
protected String geboortedatum;
protected String telefoonnummer;
protected String titel;
// Getters and setters ommited for brevity
}
Run Code Online (Sandbox Code Playgroud)
Patient.java
@Entity
@DiscriminatorValue("P")
@Table(name="PATIENT")
public class Patient extends Persoon implements Serializable {
protected String allergieen;
protected String bijzonderheden;
// Getters and setters ommited for brevity
}
Run Code Online (Sandbox Code Playgroud)
并且Test.java填充表格:
public class Test {
public static …Run Code Online (Sandbox Code Playgroud) 我有一组域对象及其相关的表,用于应用程序的配置.经过身份验证的用户可以通过表示层更改这些域对象数据.这些 域对象具有非常重要的数据,我需要找到谁和何时更改了他们的数据.我的应用程序的数据访问层是使用JPA,Hibernate和Spring实现的.我需要记录每个更改,包括:用户+操作日期+操作类型+以前的值.
例如,让我们考虑一个简单的域对象(为了这个问题的目的简化):
@Entity
class Connection
{
private Long id;
private String name;
private String protocol;
}
Run Code Online (Sandbox Code Playgroud)
假设有一个Connection具有以下值的实例:
Connection
id = 1;
name = Web;
protocol = HTTPS;
Run Code Online (Sandbox Code Playgroud)
在用户(例如John)登录UI并将此连接更改为以下值之后:
Connection
id = 1;
name = Web;
protocol = HTTP;
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,John将协议更改HTTPS为HTTP(安全协议不安全!),因此我需要将Connection实例的历史记录保存在另一个表中以便进行审计.
我为我研究了一个解决方案,并找到了以下结果:
MappedSuperClass注释,如:Create User,Create Date,Last Update User …我已经配置了所有内容来对 Maven 项目进行声纳分析。一切都很好,直到我运行sonar-runner:
Max$ sonar-runner
INFO: Scanner configuration file: /Users/Max/Documents/sonar-scanner-2.5/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: SonarQube Scanner 2.5
INFO: Java 1.7.0_45 Oracle Corporation (64-bit)
INFO: Mac OS X 10.10.3 x86_64
INFO: User cache: /Users/Max/.sonar/cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=143ms
INFO: Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
INFO: User cache: /Users/Max/.sonar/cache
INFO: Load plugins index
INFO: …Run Code Online (Sandbox Code Playgroud) java ×7
hibernate ×3
maven ×2
spring ×2
amazon-ebs ×1
analyzer ×1
auditing ×1
backup ×1
database ×1
eclipse ×1
fortify ×1
inheritance ×1
jaas ×1
java-ee ×1
jpa ×1
performance ×1
postgresql ×1
sonar-runner ×1
sonarqube ×1
sonarqube5.1 ×1
spring-mvc ×1
thread-dump ×1