Alfresco SDK 2.0-beta-4 released in Maven Central!

Watch Full Movie Online Streaming Online and Download

20 thoughts on “Alfresco SDK 2.0-beta-4 released in Maven Central!

  1. […] Gab has written a great post about the release, which includes a ton of goodies, like hot reloading java code, web scripts and client side resources. We’ve also included a records management profile and extra goodies. […]

    Reply

  2. Hi Gabriele,

    that looks impressive. I gave a try today but no luck in reloading java classes. JavaScript, ftl files works as expected but not the java backed webscript. Am I missing any trick ??

    I have maven 3.2.3. with eclipse m2e plugin 1.6 downloaded form http://download.eclipse.org/technology/m2e/milestones/1.6
    I have jdk 1.7.0_40
    Alfresco Maven SDK snapshot 2.0.0-beta4
    Alfresco 5.0.a

    Thanks,
    Vignesh

    Reply

    1. Did you run using the ./run.sh script provided? I ask that, since that will set up the springloaded environment (download and run the JVM with the agent).

      Looks like your springloaded reloading isn’t really working, but on every platform I have tested with worked with no issue.

      Reply

  3. Hi Gab,

    Is it possible to do junit testing on remote server ?

    Thanks,
    Yogesh Prajapati

    Reply

    1. Hi Marcin,

      this is a known issue. See https://issues.alfresco.com/jira/browse/ALF-9970.

      Development mode breaks the admin console, and at this point there are no plans to fix is (because the more and more admin tools are being moved to the new Alfresco repository admin console).

      You can disable dev mode by changing the share-config-custom.xml that comes bundled in the share-amp-archetype in src/test/resources/alfresco/web-extension.

      Reply

  4. Hi Gab,

    I want to do remote junit testing in such way like –
    I have created one unit test class in my local and I want to test it in my QA environment with hot reloading..

    is this possible?

    Thanks,
    Yogesh Prajapati

    Reply

    1. Yep this is possible as long as the receiving end (QA) has the proper test classes deployed in it (and it’s configured with spring-loaded to look at at location where you change your classes). In fact the class is not *serialized* and sent to the server, you only invoke test remotely that are already in the webapp.

      You can configure the @Remote annotation to point to your QA server.

      Reply

  5. Hi Gab,

    Recently I build Alfresco 5.0.a with Alfresco SDK 2.0.0-beta-4 and it really works well. however, for version 5.0.b, I am getting below error. Am I missing any configuration in POM? thanks!

    Error:
    [org.alfresco.demoamp.test.DemoComponentTest@15e1f383]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at com.tradeshift.test.remote.RemoteTestRunner.run(RemoteTestRunner.java:73)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
    Caused by: org.alfresco.error.AlfrescoRuntimeException: 09060000 Bootstrap failed
    at org.alfresco.repo.importer.ImporterBootstrap.bootstrap(ImporterBootstrap.java:362)
    at org.alfresco.repo.importer.ImporterBootstrap.onBootstrap(ImporterBootstrap.java:723)
    at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
    at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:209)
    at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:180)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    … 25 more
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘lucene’ is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:575)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1111)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory$SwitchableState.start(SwitchableApplicationContextFactory.java:116)
    at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.start(AbstractPropertyBackedBean.java:991)
    at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.getState(AbstractPropertyBackedBean.java:274)
    at

    Reply

    1. 2.0.0-beta-4 is NOT compatible with 5.0.b. We’ll release the 2.0.0 final to do so.

      In the meanwhile you can use the 2.0.0-SNAPSHOT from Maven central and that would already work (unstable) with 5.0.b.

      Reply

  6. I’m running v2 beta 4 beta AMP build archetype and get errors when trying to run integration-test amp-to-war. Message in Eclipse console always says that mysql components are missing even though I have not made any changes to the default configuration. I am expecting it to run H2 by default.

    **********************************************
    … 93 more
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.alfresco.repo.domain.schema.DataSourceCheck]: Constructor threw exception; nested exception is java.lang.RuntimeException: Database connection failed: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:108)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
    … 104 more
    Caused by: java.lang.RuntimeException: Database connection failed: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.alfresco.repo.domain.schema.DataSourceCheck.(DataSourceCheck.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    … 106 more
    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at org.alfresco.repo.domain.schema.DataSourceCheck.(DataSourceCheck.java:53)
    … 111 more
    Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
    … 114 more

    Oct 21, 2014 2:27:39 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
    INFO: WSSERVLET12: JAX-WS context listener initializing
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate
    INFO: WSSERVLET14: JAX-WS servlet initializing
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/alfresco] startup failed due to previous errors
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate destroy
    INFO: WSSERVLET15: JAX-WS servlet destroyed
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed
    INFO: WSSERVLET13: JAX-WS context listener destroyed
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.ApplicationContext log
    INFO: Shutting down log4j
    Oct 21, 2014 2:27:46 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
    SEVERE: The web application [/alfresco] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@6dd1f5aa]) and a value of type [org.apache.cxf.bus.CXFBusImpl] (value [org.apache.cxf.bus.CXFBusImpl@7357a439]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    Oct 21, 2014 2:27:46 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
    SEVERE: The web application [/alfresco] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@4386be8a]) and a value of type [java.util.WeakHashMap] (value [{class javax.xml.bind.annotation.W3CDomHandler=java.lang.ref.WeakReference@6ce82fb5}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    Oct 21, 2014 2:27:46 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“http-bio-8080”]

    Reply

    1. It should use h2 by default. What are you using to run it, Eclipse directly ? Or the provided run.sh?

      Seems like Eclipse (or something else) is overriding the global properties, which should be picked from src/test/properties/local/alfresco-global.properties.

      Can you raise an issue at https://github.com/Alfresco/alfresco-sdk/issues if this is isn’t fixed yet?

      Reply

      1. I am building the project using the mvn archetype:generate…… command and then import to Eclipse. I will submit an issue. Thank you.

        I’m also curious as to where web script Javascript debug output goes when running integration-test. I’ve set DEBUG and log4j.logger.org.alfresco.repo.jscript.ScriptLogger=DEBUG and the Debug-Output is checked in Eclipse run configuration. There is no debug statement in the console or the log file. Java program debug statements appear as expected.

        Reply

        1. Regarding the debug statement output, I’m referring to v1 of the Maven SDK.

          Reply

  7. Hi, Gab! Can you help me please with remote JUnit testing on all-in-one-archetype? I’m using IntelliJ IDEA.

    I succeeded in remote testing amp-archetype. And I want to say it’s really awesome!

    But when I try to do the trick with all-in-one using MAVEN_OPTS=”-Xms1024m -Xmx2048m -XX:PermSize=1024m -javaagent:/path/to/springloaded-1.2.0.RELEASE.jar -noverify” mvn clean install -Prun
    every tinny test is trying to re-start the whole Alfresco. Ofcource it fails by “Address already in use” exception.

    Can you tell me please, what am I doing wrong? Is it incorrect configuration of @Remote annotation (@Remote(runnerClass = SpringJUnit4ClassRunner.class)) and for all-ion-one testing it should be different?

    Reply

    1. I finally solved this problem. But I don’t think my approach is correct.

      1. First of all I realised that during unit-testing there is no JUnit RemoteServer listening for tests on localhost:4578.
      2. So then I figured out alfresco-rad-2.0.0-beta-4.jar is not imported in repo.
      3. And last but not least. My solution was to remove test from

      org.alfresco.maven
      alfresco-rad
      ${maven.alfresco.version}
      test

      in the alfresco-sdk-parent-2.0.0-beta-4.pom

      Sooooo… I really suffer the lack of knowledge in Maven. But it seems to me that I’m totally wrong in my approach.

      Reply

  8. Hi Gabriele,

    I have used Alfresco SDK 2.0-beta-4 both in Eclipse and from the command line with Alfresco 5.0.a and Share 5.0.a. Now, when I try to use Alfresco 5.0.c and Share 5.0.c, both in alfresco repo and share “mvn integration-test -Pamp-to-war” produces this error;

    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:331)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

    Is this a known problem or do you think I miss something about 5.0.c?
    I also tried to use the 2.0.0-SNAPSHOT, but I have a different error:

    ERROR] Non-resolvable parent POM for org.alfresco.maven:alfresco-sdk-parent:2.0.0-SNAPSHOT: Could not find artifact org.alfresco.maven:alfresco-sdk-aggregator:pom:2.0.0-SNAPSHOT in alfresco-public (https://artifacts.alfresco.com/nexus/content/groups/public) @ org.alfresco.maven:alfresco-sdk-parent:2.0.0-SNAPSHOT, /home/alfresco/.m2/repository/org/alfresco/maven/alfresco-sdk-parent/2.0.0-SNAPSHOT/alfresco-sdk-parent-2.0.0-SNAPSHOT.pom, line 14, column

    Do you have any suggestion to get out of the impasse?

    thanks for your help,

    ciao Francesco

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *