[Microcontainer] - Re: Neither 2.0-SNAPSHOT nor 2.0.Beta work with Maven build
by genman
I would suggest making some of those dependencies "optional" or "test" or "provided".
Beta looks like this:
| repository\apache-httpclient\commons-httpclient\2.0.2\commons-httpclient-2.0.2.jar
| repository\apache-slide\webdavlib\2.0\webdavlib-2.0.jar
| repository\apache-xerces\xercesImpl\2.7.1\xercesImpl-2.7.1.jar
| repository\apache-xerces\xml-apis\2.7.1\xml-apis-2.7.1.jar
| repository\concurrent\concurrent\1.3.4\concurrent-1.3.4.jar
| repository\javassist\javassist\3.4.GA\javassist-3.4.GA.jar
| repository\jboss\jboss-aop-mc-int\2.0.0.Beta\jboss-aop-mc-int-2.0.0.Beta.jar
| repository\jboss\jboss-aop\2.0.0.alpha2\jboss-aop-2.0.0.alpha2.jar
| repository\jboss\jboss-common-core\2.0.2.GA\jboss-common-core-2.0.2.GA.jar
| repository\jboss\jboss-container\2.0.0.Beta\jboss-container-2.0.0.Beta.jar
| repository\jboss\jboss-dependency\2.0.0.Beta\jboss-dependency-2.0.0.Beta.jar
| repository\jboss\jboss-kernel\2.0.0.Beta\jboss-kernel-2.0.0.Beta.jar
| repository\jboss\jboss-logging-spi\2.0.2.GA\jboss-logging-spi-2.0.2.GA.jar
| repository\jboss\jbossxb\1.0.0.CR8\jbossxb-1.0.0.CR8.jar
| repository\oswego-concurrent\concurrent\1.3.4\concurrent-1.3.4.jar
| repository\sun-jaf\activation\1.0.2\activation-1.0.2.jar
| repository\trove\trove\1.0.2\trove-1.0.2.jar
| repository\wutka-dtdparser\dtdparser121\1.2.1\dtdparser121-1.2.1.jar
|
which isn't quite as long.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066320#4066320
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066320
18Â years, 9Â months
[Microcontainer] - Neither 2.0-SNAPSHOT nor 2.0.Beta work with Maven build
by genman
I'm using Maven to build my project against the JBoss repository.
Using these dependencies:
<dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-container</artifactId>
| <version>2.0.0-SNAPSHOT</version>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-kernel</artifactId>
| <version>2.0.0-SNAPSHOT</version>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-aop-mc-int</artifactId>
| <version>2.0.0-SNAPSHOT</version>
| </dependency>
and my own -beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="Simple" class="....SimpleBean">
| <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="test:type=SimpleBean", exposedInterface=....SimpleBeanMBean.class)</annotation>
| </bean>
|
| <bean name="MBeanServer" class="java.lang.Object">
| <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="createMBeanServer" />
| </bean>
|
| <bean name="AspectManager" class="org.jboss.aop.AspectManager">
| <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance" />
| </bean>
|
| <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0" name="DependencyAdvice" class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction"
| classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX">
| <property name="mbeanServer">
| <inject bean="MBeanServer" />
| </property>
| </aop:lifecycle-configure>
|
|
| </deployment>
causes this:
| 2007-07-20 12:17:38,312 ERROR [AbstractKernelController] (main) Error installing to PreInstall: name=Simple state=Not Installed
| java.lang.NoSuchMethodError: javassist.scopedpool.ScopedClassPool.<init>(Ljava/lang/ClassLoader;Ljavassist/ClassPool;Ljavassist/scopedpool/ScopedClassPoolRepository;Z)V
| at org.jboss.aop.classpool.AOPClassPool.<init>(AOPClassPool.java:66)
| at org.jboss.aop.classpool.AOPClassPool.<init>(AOPClassPool.java:56)
| at org.jboss.aop.classpool.AOPClassPoolFactory.create(AOPClassPoolFactory.java:40)
| at javassist.scopedpool.ScopedClassPoolRepositoryImpl.createScopedClassPool(ScopedClassPoolRepositoryImpl.java:99)
| at javassist.scopedpool.ScopedClassPoolRepositoryImpl.registerClassLoader(ScopedClassPoolRepositoryImpl.java:125)
| at javassist.scopedpool.ScopedClassPoolRepositoryImpl.findClassPool(ScopedClassPoolRepositoryImpl.java:106)
|
For
<dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-container</artifactId>
| <version>2.0.0.Beta</version>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-kernel</artifactId>
| <version>2.0.0.Beta</version>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-aop-mc-int</artifactId>
| <version>2.0.0.Beta</version>
| </dependency>
I get:
| java.lang.Error: org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/src/workspace/jboss-mc-test/target/test-classes/META-INF/jboss-beans.xml@18,61
| at ...jbossmc.DeployTest.testIt(DeployTest.java:33)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
| at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
| at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
| at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
| at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
| at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
| at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
| at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
| at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
| at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
| at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/src/workspace/jboss-mc-test/target/test-classes/META-INF/jboss-beans.xml@18,61
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:164)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:133)
| at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:135)
| at com.autodesk.lbs.jbossmc.DeployTest.testIt(DeployTest.java:30)
| ... 20 more
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:aop-beans:1.0}lifecycle-configure not found as a child of {urn:jboss:bean-deployer:2.0}deployment
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:280)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:160)
| ... 23 more
|
|
... I'm also seeing a lot of dependencies pulled in for SNAPSHOT which I don't for Beta.
I do wonder what the heck some of the dependencies are for, for example ant- and webdavlib- ... jboss-profiler, etc.
Here's the list for my mini-project, which depends on SNAPSHOT-2.0:
repository\ant\ant\1.6.5\ant-1.6.5.jar
| repository\apache-httpclient\commons-httpclient\2.0.2\commons-httpclient-2.0.2.jar
| repository\apache-log4j\log4j\1.2.8\log4j-1.2.8.jar
| repository\apache-slide\webdavlib\2.0\webdavlib-2.0.jar
| repository\apache-xerces\xercesImpl\2.7.1\xercesImpl-2.7.1.jar
| repository\apache-xerces\xml-apis\2.7.1\xml-apis-2.7.1.jar
| repository\javassist\javassist\3.4.GA\javassist-3.4.GA.jar
| repository\jboss\jboss-aop-mc-int\2.0.0-SNAPSHOT\jboss-aop-mc-int-2.0.0-SNAPSHOT.jar
| repository\jboss\jboss-aop\2.0.0-SNAPSHOT\jboss-aop-2.0.0-SNAPSHOT.jar
| repository\jboss\jboss-common-core\2.0.4.GA\jboss-common-core-2.0.4.GA.jar
| repository\jboss\jboss-common-logging-spi\2.0.4.GA\jboss-common-logging-spi-2.0.4.GA.jar
| repository\jboss\jboss-container\2.0.0-SNAPSHOT\jboss-container-2.0.0-SNAPSHOT.jar
| repository\jboss\jboss-dependency\2.0.0-SNAPSHOT\jboss-dependency-2.0.0-SNAPSHOT.jar
| repository\jboss\jboss-kernel\2.0.0-SNAPSHOT\jboss-kernel-2.0.0-SNAPSHOT.jar
| repository\jboss\jboss-logging-log4j\2.0.2.GA\jboss-logging-log4j-2.0.2.GA.jar
| repository\jboss\jboss-logging-spi\2.0.2.GA\jboss-logging-spi-2.0.2.GA.jar
| repository\jboss\jboss-test\1.0.3.GA\jboss-test-1.0.3.GA.jar
| repository\jboss\jboss-vfs\2.0.4.snapshot\jboss-vfs-2.0.4.snapshot.jar
| repository\jboss\jbossxb\1.0.0-SNAPSHOT\jbossxb-1.0.0-SNAPSHOT.jar
| repository\jboss\profiler\jvmti\jboss-profiler-jvmti\1.0.0.CR5\jboss-profiler-jvmti-1.0.0.CR5.jar
| repository\junit\junit\4.1\junit-4.1.jar
| repository\log4j\log4j\1.2.14\log4j-1.2.14.jar
| repository\org\apache\ant\ant-junit\1.7.0\ant-junit-1.7.0.jar
| repository\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar
| repository\org\apache\ant\ant\1.7.0\ant-1.7.0.jar
| repository\oswego-concurrent\concurrent\1.3.4\concurrent-1.3.4.jar
| repository\qdox\qdox\1.6\qdox-1.6.jar
| repository\sun-jaf\activation\1.0.2\activation-1.0.2.jar
| repository\trove\trove\1.0.2\trove-1.0.2.jar
| repository\wutka-dtdparser\dtdparser121\1.2.1\dtdparser121-1.2.1.jar
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066317#4066317
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066317
18Â years, 9Â months
[EJB/JBoss] - how can avoid OptimisticLockException
by serj_
hello,
I don't know how to solve concurrency problems in a nice way. To fix my updating code I set version control for entity and I check if get OptimisticLockException.
I think this is not the best solution, so I wish to know what is a beter solution for this classic case. I think I should get a record, lock it, update fields and unluck it ... but I don't know how to do it.
Thanks a lot for help
My code for update looks like this (strange enough for only one update):
| while(true){
| boolean ok = true;
| Balance balance = testSessionA.getBalance(id,sleepTime);//sleep used just for testing
| balance.setAmount(balance.getAmount()+10);
| try{
| testSessionA.update(balance);
| }catch(javax.ejb.EJBException ex){
| ex.printStackTrace();
| if(ex.getMessage().equals("javax.persistence.OptimisticLockException")){
| //how many times we should try to update??
| ok = false;
| }
| }
| if(ok){
| break;
| }
| }
|
|
I have a stateless session bean,
| @Stateless
| @Remote(TestSessionA.class)
| @Local(TestSessionA.class)
| public class TestSessionABean implements TestSessionA{
|
| public Balance getBalance(long bId, long sleepTime) throws Exception {
| Balance b = em.find(Balance.class, bId);
| Thread.sleep(sleepTime);//use sleep just to test
| return b;
| }
|
| public void update(Balance balance) {
| em.merge(balance);
|
| }
|
|
and Balance entity have version controll:
| @Entity
| public class Balance implements Serializable{
|
| @Version
| @Column(name = "OPTLOCK")
| public int getVersion() {
| return version;
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066316#4066316
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066316
18Â years, 9Â months