I have successfully deployed alfresco community 4.2.f in a Tomcat 7.0.59 with a database MySQL5.6 and jdk1.8.0_141
No problems thus far, now, I got a module developed by our company which I need to be deployed in alfresco. This module invokes a WS which will send a PDF to some place.
I got this module in a jar compiled with jdk1.8.0_141
I tried to put it inside the alfresco.war before deployment in Tomcat in WEB-INF/lib but when I do that and deploy with startup.bat from Tomcat it pops in the console
instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/codehaus/xfire/XFireRuntimeException
I understand this exception is caused by putting the jar inside the war.
I was told that the jar was compiled also in jdk8.
Also, tell you that if instead of this jar I put inside the alfresco.war in WEB-INF/classes a properties file to get our database in deployment it works fine.
The problem is when I try to deploy the module.
I saw there are quite tutorials pointing to do something like:
java -jar bin/alfresco-mmt.jar
I can't do that because this is done installing alfresco with its wizard I assume. I did it deploying alfresco in a fresh tomcat installation.
Does anyone know how to deploy our module with the way we deployed alfresco? Thank you.
You have two ways to install your amp :
The first traditional one :
This is the one installed with the apply amp procédure (alfresco-mmt).
To me, this is not true that it is not compatible with your installation. You can easily find the bin folder (containing the alfresco-mmt.jar file) here in the alfresco packaging : https://download.alfresco.com/release/community/4.2.f-build-00012/alfresco-community-4.2.f.zip
When you have it, you can follow the documentation : http://docs.alfresco.com/4.2/tasks/amp-install.html
And apply your amp for example following this way :
java -jar alfresco-mmt.jar install <AMPFileLocation> <WARFileLocation>
The second one :
You can recreate the war with the alfresco sdk and include in the build the module you created.
If you follow this documentation : http://docs.alfresco.com/4.2/tasks/dev-extensions-maven-sdk-tutorials-all-in-one-archetype.html
the war produced in the target folder of the repo part will contain your module, since the pom of this module will contains a dependency to the amp module :
...
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco</artifactId>
<type>war</type>
</dependency>
<!-- Demonstrating the dependency on the repo AMP developed in the 'amp'
module -->
<dependency>
<groupId>x.y.z</groupId>
<artifactId>my-amp</artifactId>
<version>${my-amp.version}</version>
<type>amp</type>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- Here is can control the order of overlay of your (WAR, AMP, etc.)
dependencies | NOTE: At least one WAR dependency must be uncompressed first
| NOTE: In order to have a dependency effectively added to the WAR you need
to | explicitly mention it in the overlay section. | NOTE: First-win resource
strategy is used by the WAR plugin -->
<overlays>
<!-- Current project customizations -->
<overlay />
<!-- The Alfresco WAR -->
<overlay>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco</artifactId>
<type>war</type>
<!-- To allow inclusion of META-INF -->
<excludes />
</overlay>
<!-- Add / order your AMPs here -
<overlay>
<groupId>x.y.z</groupId>
<artifactId>my-amp</artifactId>
<type>amp</type>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
Related
I'm currently working with Intellij as IDE, and I have 4 projects:
- An Admin project (contains java & ember for the front-end)
- An WS project (contains the WS)
- An API project (contains the objects, dao's etc)
- A master project which only contains a pom to reference the other 3.
Admin and WS depend on API.
I deploy everything in JBoss. Maven clean-install works, but I can't deploy to jboss: I get a ClassNotFoundError: WS can't find classes in API
My pom of the master file looks like this:
<dependencies>
<dependency>
<groupId>API</groupId>
<artifactId>API</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../api/target/API-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>WS</groupId>
<artifactId>WS</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../ws/www/target/WS-1.0.war</systemPath>
</dependency>
<dependency>
<groupId>Admin</groupId>
<artifactId>Admin</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../admin/www/target/Admin-1.0.war</systemPath>
</dependency>
</dependencies>
I use Maven 3.3.3 and Jboss WildFly 8.2.1
In Project Settings I've simply put the 3 Maven libraries (Admin, WS, API) under
In the Deployement tab of the Jboss condfiguration, the 2 wars (Admin, WS) and the jar (API) are listed
The errors I get:
Failed to define class ...ws.endpoints.helpers.WS in Module "deployment.WS-1.0.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link .../ws/endpoints/helpers/WS (Module "deployment.WS-1.0.war:main" from Service Module Loader) Caused by: java.lang.NoClassDefFoundError: .../dao/helpers/Dao Caused by: java.lang.ClassNotFoundException: ...dao.helpers.Dao from [Module "deployment.WS-1.0.war:main" from Service Module Loader]
What am I doing wrong? Is there a better way to deploy all this?
I've also tried to use the local Maven repository to find the correct depedencies (removed the scope and system path), but I can't find them, although they are correct located under the C:\users.m2 directory
Thanks in advance!
Specifying scope as 'system' means that your artifact is always available and is not looked up in a repository, so if you are building those artifacts during your build life cycle - "system" scope is not the right way to go.
I would recommend:
1. Try packaging your artifacts and deploy to JBoss manually, just to make sure that it works
2. Then try it out with Maven plugin for JBoss: http://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
I'm having trouble getting Eclipse to properly publish overlayed WARs locally to a weblogic server. Running a maven clean package correctly assembles the EAR with the proper webapp content imported. I've found several similar questions but none appear to be recent or the same issue.
Looking in my org.eclipse.wst.common.component file, the dependent-module for the overlay resource is correctly generated, as well.
I'm using m2e-wtp 1.0.1.20130911-1545
Is there additional configuration that I need to do to get the server publishing to read that overlay?
Editing with more info:
Here is the excerpt from the WARs pom.xml
<dependencies>
<dependency>
<groupId>com.abc</groupId>
<artifactId>core-webcontent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<overlays>
<overlay>
<groupId>com.abc</groupId>
<artifactId>core-webcontent</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
Here is the excerpt from the component file
<dependent-module deploy-path="/" handle="module:/overlay/prj/core-webcontent?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
I tried doing an export on the EAR locally so that I could view the EAR and see if the files are being added to a different location, but it seems that does not work at all from this type of setup.
I tried on JBoss AS 7.x/Wildfly 8.w without any problem. I downloaded Weblogic to try (I never used it) and I can confirm the behavior you see.
The problem is caused by Weblogic serving files directly from the workspace location. This is the same problem that prevents overlay from working for Tomcat's "Serve without publishing" mode. Basically the overlay components provided by m2e-wtp are ignored when serving the webapps directly from source.
JBoss Servers and Tomcat's default mode support overlays because the webapp is published to another location and served from there. That publishing step allows to add, then serve, the overlaid files.
The following changes allow Weblogic to do the same :
* in the servers view, remove the EAR from your weblogic server
* right-click on the weblogic server and open the Properties dialog
* Go to Weblogic > Publishing
* Select "Publish as an exploded archive" and press OK
* Re-deploy your EAR on the weblogic server
It should now be served from [workspace/path]/.metadata/.plugins/org.eclipse.core.resources/.projects/[earproject]/beadep/[domain]/[earproject]/
One thing I noted though, is changes from the overlaid project are not published immediately. You need to do some dummy change in the main webapp to see the overlay files be deployed.
at this point, if you want to see better support for overlays in weblogic tooling, you need to reach out to Oracle.
I am using WebSphere 7 and trying to deploy war from MyEclipse (Server > WebSphere 7 > right click > Add Deployment).
I am using below maven war plug-in:
<groupId>com.xxx.my.app</groupId>
<artifactId>my-app</artifactId>
<packaging>war</packaging>
<name>my-app</name>
<build>
<finalName>my-app-context-root</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
</build>
To change context root of my war I tried below options:
First option:
<properties>
<m2eclipse.wtp.contextRoot>my-app-context-root</m2eclipse.wtp.contextRoot>
</properties>
Second Option:
<finalName>my-app-context-root</finalName>
But no Luck so for with these options. Whenever I deploy my application/war from MyEclipse and check context root in WebSphere server, WebSphere still shows the context root as 'my-app' (which is mentioned in name tag) not 'my-app-context-root'.
One approach could be changing the war file [ my-app tag] to context root name. This way it will deploy the application with desired context root name.
deploy your war file or application in myeclipse tomcat server and right click on the project folder, select properties and go to web option from the MyEclipse menu. there you can change the context-root of an application. The below link may helpful to you.
Change application context-root in myeclipse
For the direct deployment by MyEclipse, MyEclipse generates some special configuration files like the ibm-web-bnd.xml. These files contain the root path. If you want to specify the context root you have to either get those to work WAS specific files to work or pack your war file into a ear file and deploy the ear.
I'm running the goal: tomcat:deploy. There are no errors, but it's not deploying my project into tomcat. I noticed this message:
[INFO] Skipping non-war project
What defines the "war-ness" of my project? How do I make my Eclipse project a war project?
Here's my plugin setting:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
I have my structure like this:
src > main > java
src > main > webapp > WEB-INF > web.xml
This one works with the maven:war plugin. I'm able to build a war with this structure.
My end objective is to do away with the war building part and be able to deploy my project to tomcat with one maven command.
Maybe you are missing the 'packaging' element in your pom.xml:
<packaging>war</packaging>
If you don't include one, the default packaging is 'jar'.
Good evening!
Using Cargo via Maven, I've configured my pom.xml to create an instance of glassfish and then deploy my project to it, before running integration tests. I'm most of the way there, in that I've got my code deployed, I've setup a datasource and a JNDI resource for it, but when I attempt to actually use the resource, I get the following exception:
Wrong class name or classpath for Datasource Object
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
On a regular installation of glassfish, I can easily install the connector, but the installation of glassfish in this case is automated and a new instance is created each time I run the tests.
Is there any way that I can provide the mysql connector, either on a classpath that glassfish can read, or by installing it in the new instance of glassfish that's created each build?
Thanks!
Scouring the docs a little more, I found out that I can do this by providing maven dependencies in the container configuration, like so:
<configuration>
<container>
<containerId>glassfish3x</containerId>
<artifactInstaller>
<groupId>org.glassfish.main.distributions</groupId>
<artifactId>glassfish</artifactId>
<version>${glassfish.version}</version>
</artifactInstaller>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
</container>
<configuration>
<properties>
<cargo.datasource.datasource.mysql>
cargo.datasource.jndi=jdbc/MysqlPool|
cargo.datasource.driver=com.mysql.jdbc.Driver|
cargo.datasource.url=jdbc:mysql://localhost/databasename|
cargo.datasource.transactionsupport=LOCAL_TRANSACTION|
cargo.datasource.username=username|
cargo.datasource.password=password
</cargo.datasource.datasource.mysql>
</properties>
</configuration>
</configuration>
Take note of the mysql dependency. It needs to reference a dependency already defined in my project (which, for my project has a scope of "provided"). This works as expected. :)