- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一组使用 Maven 构建的 AspectJ 1.6.12 和 Spring 3.1.2.RELEASE 在 JBoss 6.1.0.Final 上运行没有问题的 WAR。我们想在不久的将来迁移到 JBoss AS 7,所以我从源代码编译了 JBoss 7.1.3.Final。
在遇到单个 WAR 文件问题后,我决定将应用程序重新打包为 EAR 文件,这样我们的所有代码都将放在一个可再分发、可部署的单元中。
我无法让我们的分析方面正常工作。这是一个非常简单的方面,包含在我们的 EAR/lib 目录中的 JAR 中,它对使用 @Timed 注释注释的任何方法进行计时:
package com.mycompany.toplayer.perf;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class MethodTimerAdvice {
private Logger log = LoggerFactory.getLogger(getClass());
@SuppressWarnings("unchecked")
@Around(value="execution(@com.mycompany.toplayer.perf.Timed * *(..))")
public Object timeMethod(ProceedingJoinPoint pjp) throws Throwable
{
String methodName = pjp.getSignature().toShortString();
long start = System.currentTimeMillis();
Object ret = pjp.proceed();
long end = System.currentTimeMillis();
long total = end - start;
long used_mem = Runtime.getRuntime().totalMemory()
- Runtime.getRuntime().freeMemory();
long mem_gb = used_mem / (1024 * 1024);
log.trace("{} | {} | {}M | {} | {} | {}",
new Object[] {start, total,
mem_gb,
Thread.currentThread().getId(),
Thread.currentThread().getName(),
methodName}
);
return ret;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mycompany" />
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
</beans>
Caused by: java.lang.IllegalArgumentException: warning no match for this type name: Timed [Xlint:invalidAbsoluteTypeName]
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301) [aspectjtools.jar:]
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getFallbackPointcutExpression(AspectJExpressionPointcut.java:358) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getShadowMatch(AspectJExpressionPointcut.java:409) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:272) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:226) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:264) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:296) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1598) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
... 28 more
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.hibernate" slot="main"/>
</exclusions>
</deployment>
<sub-deployment name="gdm-updater-1.2.0-SNAPSHOT.war">
<exclusions>
<module name="org.hibernate" slot="main"/>
</exclusions>
<dependencies>
<module name="org.aspectj.tools" slot="main" />
<module name="org.aspectj.weaver" slot="main" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<Xlint>ignore</Xlint>
<complianceLevel>${compiler.version}</complianceLevel>
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
最佳答案
我们最近在从 JBoss EAP 6.4.8 升级到 6.4.9 时遇到了类似的问题。
我们的 JNDI 数据源的数据源实现似乎从 org.jboss.jca.adapters.jdbc.WrapperDataSource
更改了。至org.jboss.as.connector.subsystems.datasources.WildFlyDataSource
.
我们在应用程序的 jboss-deployment-structure.xml
中添加了以下部署依赖项文件为我们解决了问题。
<module name="org.jboss.as.connector" slot="main"/>
WildFlyDataSource
执行。与此线程中的其他人一样,我们之前已经拥有
org.jboss.ironjacamar.jdbcadapters
依赖。它看起来像
org.jboss.as.connector
模块可以代替它。
proxy-interface
代理您的数据源。在您的 Spring 配置中 - 例如
<jee:jndi-lookup id="dataSource" jndi-name="some_jndi_name" proxy-interface="javax.sql.DataSource" />
关于jboss7.x - JBoss AS 7 下的 AspectJ Aspect 抛出 Xlint :invalidAbsoluteTypeName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13943110/
我在服务器启动时看到以下 Spring 框架异常 ** > Initialization of bean failed; nested exception is > java.lang.Illegal
我有一组使用 Maven 构建的 AspectJ 1.6.12 和 Spring 3.1.2.RELEASE 在 JBoss 6.1.0.Final 上运行没有问题的 WAR。我们想在不久的将来迁移到
我正在开发一个基于 Spring 3.0.2 的项目。从过去三天开始,它显示以下错误。 java.lang.IllegalArgumentException: warning no match for
我的方面是: @Aspect @Service public class MyAspect { @AfterReturning(value="(execution(* find(..)) )"
我从未使用过 Spring AOP 并尝试配置我的第一个 bean。似乎我配置正确,但我得到一个找不到bean的异常。 我的方面是—— @Aspect @Component public class
我是一名优秀的程序员,十分优秀!