我在使用Weblogic 12c尝试配置Arquillian(远程容器)时遇到困难。我尝试了几次关于网络的一系列教程,包括官方的arquillian网站。正如我所说,令人沮丧。 我做了所有更改:添加了所有依赖项(pom.xml),添加了一个配置文件pom.xml - 并激活它 - 并创建了一个带有arquillian注释的测试类。在运行测试之前,我启动了weblogic,我在下面得到了这个堆栈。 我的可能性已经不多了。
Stack:
Caused by: javax.management.ReflectionException: null
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:300)
at javax.management.remote.rmi.RMIConnectionImpl_1211_WLStub.invoke(Unknown Source)
at weblogic.management.remote.common.RMIConnectionWrapper$16.run(ClientProviderBase.java:918)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.security.Security.runAs(Security.java:61)
at weblogic.management.remote.common.RMIConnectionWrapper.invoke(ClientProviderBase.java:916)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:1022)
at org.jboss.arquillian.container.wls.WebLogicJMXClient.doDeploy(WebLogicJMXClient.java:211)
at org.jboss.arquillian.container.wls.WebLogicJMXClient.deploy(WebLogicJMXClient.java:97)
at org.jboss.arquillian.container.wls.jmx.FullJMXRemoteContainer.deploy(FullJMXRemoteContainer.java:64)
at org.jboss.arquillian.container.wls.remote_12_1_2.WebLogicContainer.deploy(WebLogicContainer.java:61)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
Caused by: java.lang.NoSuchMethodException: deploy(java.lang.String,java.lang.String,java.lang.String,) for com.bea:Name=DeploymentManager,Type=DeploymentManager
at weblogic.management.jmx.modelmbean.WLSModelMBean.invoke(WLSModelMBean.java:395)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:762)
at weblogic.management.mbeanservers.domainruntime.internal.FederatedMBeanServerInterceptor.invoke(FederatedMBeanServerInterceptor.java:349)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
at weblogic.management.mbeanservers.internal.JMXContextInterceptor.invoke(JMXContextInterceptor.java:263)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
at weblogic.management.mbeanservers.internal.SecurityMBeanMgmtOpsInterceptor.invoke(SecurityMBeanMgmtOpsInterceptor.java:65)
Arquilian.xml:
<?xml version="1.0" encoding="UTF-8"?>
<arquillian
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wls-integration" default="true">
<defaultProtocol type="Servlet 3.0" />
<configuration>
<property name="adminUrl">t3://localhost:7001</property>
<property name="adminUserName">weblogic</property>
<property name="adminPassword">welcome1</property>
<property name="target">AdminServer</property>
<property name="wlHome">C://as//Oracle//Middleware//wlserver_12.1</property>
</configuration>
</container>
Pom-Dependencies:
<dependencyManagement>
<dependencies>
<!-- ###################################### -->
<!-- #### Arquillian Test Dependencies ### -->
<!-- ###################################### -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.13.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- ###################################### -->
<!-- #### Tests Dependencies ### -->
<!-- ###################################### -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1.2</artifactId>
<version>1.0.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.7.Final</version>
<scope>test</scope>
</dependency>
班级:
@RunWith(Arquillian.class)
public class TestWls {
@Deployment(testable = false)
public static Archive<?> createDeployment() {
return ShrinkWrap.create(WebArchive.class,"test.war")
.addPackage(Test.class.getPackage()).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Test
public void test() {
System.out.println("Test");
}
}
配置wls-maven-plugin的配置文件:
<profiles>
<profile>
<id>wls-integration</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1.2</artifactId>
<version>1.0.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wls-maven-plugin</artifactId>
<version>12.1.1.0</version>
<configuration>
<adminmode>true</adminmode>
<adminurl>${weblogic.adminurl}</adminurl>
<user>${weblogic.username}</user>
<password>${weblogic.user.pwd}</password>
<name>${project.build.finalName}</name>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<middlewareHome>${middleware.home}</middlewareHome>
<weblogicHome>${weblogic.home}</weblogicHome>
<domainHome>${weblogic.domain}</domainHome>
</configuration>
<executions>
<execution>
<id>up</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>down</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>