cancel
Showing results for 
Search instead for 
Did you mean: 

command line Export/Import and ServletContext error

joop
Champ in-the-making
Champ in-the-making
Hi, this is my first attempt to use the command line Export functionality and I get this error:
Alfresco Repository Exporter
The following error has occurred:
javax/servlet/ServletContext
java.lang.NoClassDefFoundError: javax/servlet/ServletContext
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.getDeclaredMethods(Class.java:1791)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:267)
etc.

The above is with alfresco community edition 3.2r2.
Now my java programming skills are a bit rusty, but I would not expect a commandline program to need a servlet context.
Could this be a bug or am I doing something wrong?

The command is taken from the example on the Wiki:
<java and classpath> org.alfresco.tools.Export -user admin -pwd <xxxx> -store user://alfrescoUserStore -verbose users.acp
The wiki 3.1 classpath was used as a basis and I replaced all xxx.jar entries for which I identified newer files .
6 REPLIES 6

joop
Champ in-the-making
Champ in-the-making
Sorry for the noise. It seems that although it is command line functionality, the Servlet server is being used.
In fact I have to bring Alfresco down in order allow the import to succeed (mysql must still be running). Else a "Port already in use: 50501" error occurs.

My problem was basically that not all needed jars were listed in the Wiki example command for 3.1.
Adding them step by step based on all the NoClassDefFoundError messages in the end it ran.
No I can finally import external documents using uuibinding CREATE_NEW.

Too bad the server needs to go down.

shea
Champ in-the-making
Champ in-the-making
Hi Joop,

Thank you for your helpful posts.  I am trying to get the command line import on Alfresco 3.1 to work for a week now.
After hours of putting the jar files together, I finally was able to invoke import via command line.  But I got the following error:
< 15:28:40,194  INFO  [alfresco.config.SystemPropertiesFactoryBean] Loading properties file from class path resource [alfresco/domain/hibernate-cfg.properties]
< 15:29:05,316  WARN  [hibernate.cfg.SettingsFactory] Could not obtain connection metadata


Could you please share your hibernate-cfg.properties file?  I am reading the hibernate reference book, and added few properties in there, but still could not get it to work.

Appreciated if you could help.  Thanks

joop
Champ in-the-making
Champ in-the-making
I have not touched this file. It came with 3.2.r2 and is dated  12 nov 2009 16:49
Anyway, the content is:
+++++++++++++++++++
#
# Hibernate configuration
#

# The Hibernate Dialect:
#    As of V3.1, the dialect is automatically detected.
#    It is still possible to set the dialect explicitly, for example:
#       hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

hibernate.jdbc.use_streams_for_binary=true
hibernate.show_sql=false
hibernate.cache.use_query_cache=true
hibernate.max_fetch_depth=10
hibernate.cache.provider_class=org.alfresco.repo.cache.InternalEhCacheManagerFactoryBean
hibernate.cache.use_second_level_cache=true
hibernate.default_batch_fetch_size=1
hibernate.jdbc.batch_size=32
hibernate.connection.release_mode=auto
hibernate.connection.isolation=2

#hibernate.query.substitutions=
#hibernate.jdbc.use_get_generated_keys=false

# Oracle Schema Distinction:
#    See https://issues.alfresco.com/jira/browse/ETHREEOH-680
#    Metadata queries to Oracle have to be limited by schema name
#    when multiple instances of Alfresco are installed on an Oracle server.
#hibernate.default_schema=

shea
Champ in-the-making
Champ in-the-making
Thanks for your quick response.  Appreciated very much. 
One more question, do you have to change the custom-connection-pool-context.properties file?
If you do, could you please share it?

I know that Alfresco 3.1 has a different configuration and setup.
My last hope is to try import command line on Alfresco 3.2.

Thanks

joop
Champ in-the-making
Champ in-the-making
I did not make any changes to any .properties file.
All effort I can recall had to do with the classpath. And of course the content of the .acp (mainly the xml).

Joop

shea
Champ in-the-making
Champ in-the-making
Thanks again. Very much appreciated. I'll try it on Alfresco 3.2 to see I'll get better luck with it.