Get Eclipse to select a maven profile when deploying to tomcat - eclipse

Can anyone tell me how I can get a profile to be picked up when running a web project from inside eclipse. This is my latest attempt, which does not work (file-dev.xml not parsed). I have a war project which has a dependency on a jar project. Th jar project contains the spring beans.
in pom.xml of jar project:
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>dev</env>
</properties>
</profile>
<profile>
<id>uat</id>
<properties>
<env>uat</env>
</properties>
</profile>
</profiles>
Also in the pom, I have added this to the maven-jar-plugin
<configuration>
<argLine>-Dspring.profiles.active=dev</argLine>
</configuration>
in spring config xml file:
<import resource="file.xml" />
in file.xml
<import resource="file-dev.xml" />
in file-dev.xml
<beans profile="dev">
<bean id="myBean"> etc etc </myBean>
</beans>
running mvn help:active-profiles returns " - dev"
Any idea what I cma missing? I have not tried any maven build or install yet, I just want it working in the dev environment, so we can deploy to tomcat from within eclipse first.
Thanks in advance

Related

Build single update-site for RAP and RCP flavored feature

I have a build for a single-sourced RCP/RAP Eclipse feature project that uses maven profiles to either build RAP or RCP bundles, fragments and features.
This works reasonably well. If I include my update site project as module in the above build's parent POM I can also easily build a platform-specific update-site using either "eclipse-update-site" (or "eclipse-repository") packaging.
However, I was wondering, if there is a way to
build RCP target platform > publish to local repo
build RAP target platform > publish to local repo
run build for RCP (target platform from step 1) > publish to local repo
run build for RAP (target platform from step 2) > publish to local repo
run build for update site only, include feature for RAP and for RCP (not compiling anything, just assembling from 1+2)
I could successfully execute steps 1-4, but not 5, because Tycho was trying to resolve the features referenced by the category.xml with a different qualifier.
If I understand update sites/p2 repositories correctly, it should be possible to offer any artifacts / bundles / features in various flavors, right?
How can I solve this, or rather: can I have a single tycho build that runs the above build steps consecutively with the same qualifier for all?
Addendum: This existing question goes in the same direction and suggests to "install the (feature) Tycho project(s) into ... local Maven repository". That's actually what I'm doing when I run 1. and 2. after each other, specifiying the same local repo for both. But then 3. fails to pull the referenced artifacts from there, because the qualifier is different (two distinct reactor builds). Running everything in the same reactor build would be totally fine for me, but I think that's not possible, because there are different target platforms involved.
I think the solution there is pretty close to what I need, but I don't understand how my category.xml (or site.xml) and the extra dependencies in POM work together. Do I have to abandon category.xml altogether and respecify all my dependencies in the eclipse-repository POM?
My build roughly looks like this:
foo.releng/pom.xml (parent POM)
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.bar</groupId>
<artifactId>foo</artifactId>
<version>0.31.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho-version>1.0.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco-version>0.7.6.201602180812</jacoco-version>
</properties>
<modules>
<module>../foo.plugin1</module>
<module>../foo.plugin2</module>
<!-- feature module is built depending on target platform, see below -->
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- target and dependency-resolution are RAP/RCP dependent, see profiles below -->
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>target-rcp</id>
<activation>
<property>
<name>target.platform</name>
<value>rcp</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rcp</module>
<module>../foo.feature.rcp</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<artifact>
<groupId>net.bar</groupId>
<artifactId>net.bar.foo.target.rcp</artifactId>
<version>${project.version}</version>
<classifier>rcp</classifier>
</artifact>
</target>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui</id>
<versionRange>0.0.0</versionRange>
</requirement>
... more rcp-only dependencies
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>target-rap</id>
<activation>
<property>
<name>target.platform</name>
<value>rap</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rap</module>
<module>../foo.feature.rap</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
... same as for RCP above, but for RAP
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
An this is the updatesite/category.xml
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/net.bar.foo.feature.rcp_0.31.0.qualifier.jar" id="net.bar.foo.feature.rcp" version="0.31.0.qualifier">
<category name="net.bar.rcp"/>
</feature>
<feature url="features/net.bar.foo.feature.rap_0.31.0.qualifier.jar" id="net.bar.foo.feature.rap" version="0.31.0.qualifier">
<category name="net.bar.rap"/>
</feature>
<category-def name="net.bar.rcp" label="RCP">
<description>
RCP Platform Features
</description>
</category-def>
<category-def name="net.bar.rap" label="RAP">
<description>
RAP Platform Features
</description>
</category-def>
</site>
And the updatesite/pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>0.31.0-SNAPSHOT</version>
<relativePath>../foo.releng/pom.xml</relativePath>
<artifactId>foo</artifactId>
<groupId>net.bar</groupId>
</parent>
<artifactId>net.bar.foo.updatesite</artifactId>
<packaging>eclipse-repository</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<archiveSite>true</archiveSite>
</configuration>
</plugin>
</plugins>
</build>
</project>
This question which concerns a very similar problem helped me to find a solution.
I succeded by configuring the tycho-packaging-plugin with a reproducible timestamp qualifier.
By using a constant version qualifier (based on the git commit ID) for all of my consecutive builds, the final repository build could resolve all referenced feature bundles correctly in the local maven repo.
After this adjustment the following build runs through without any problems and publishes a RAP and RCP feature flavor:
# build rcp target
cd foo/net.bar.foo.target.rcp
mvn clean install -Dmaven.repo.local=../../m2
# build rap target
cd ../net.bar.foo.target.rap
mvn clean install -Dmaven.repo.local=../../m2
# build features and plugins for rcp, then for rap
cd ../net.bar.foo.releng
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rcp
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
# build p2 repository
cd ../net.bar.foo.updatesite
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
VoilĂ :

Project build error after successful import

I'm importing already exisiting maven JBOS Fuse 6.3 camel project into Jboss Developer Studio. After successful import i'm getting following error,
I'm geeting this error in parent POM
Project build error: Non-resolvable parent POM for org.jboss.quickstarts.eap:jboss-quickstart-parent:6.4.0.GA: Failure to transfer org.jboss:jboss-parent:pom:8 from http://
maven.repository.redhat.com/techpreview/all was cached in the local repository, resolution will not be reattempted until the update interval of jboss-ga-repository has
elapsed or updates are forced. Original error: Could not transfer artifact org.jboss:jboss-parent:pom:8 from/to jboss-ga-repository (http://maven.repository.redhat.com/
techpreview/all): maven.repository.redhat.com and 'parent.relativePath' points at no local POM
Parent POM.xml
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.jboss
jboss-parent
8
org.jboss.quickstarts.eap
<artifactId>jboss-quickstart-parent</artifactId>
<version>6.4.0.GA</version>
<packaging>pom</packaging>
<name>JBoss EAP Quickstart: Parent</name>
<description>JBoss EAP Quickstarts Parent</description>
<url>http://www.jboss.org/jdf/quickstarts/get-started/</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<properties>
<!-- A base list of dependency and plugin version used in the various quick starts. -->
<version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
<!-- other plugin versions -->
<version.com.mycyla.license>2.5</version.com.mycyla.license>
</properties>
<build>
<plugins>
<!-- The JBoss AS plugin deploys your apps to a local JBoss EAP container -->
<!-- Disabling it here means that we don't try to deploy this POM! -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${version.jboss.maven.plugin}</version>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${version.com.mycyla.license}</version>
<configuration>
<header>${basedir}/dist/license.txt</header>
<aggregate>true</aggregate>
<strictCheck>true</strictCheck>
<excludes>
<exclude>target/**</exclude>
<exclude>.clover/**</exclude>
<exclude>**/*.sql</exclude>
<exclude>**/LICENSE*</exclude>
<exclude>**/license*</exclude>
<!-- Exclude specific Quickstarts -->
<exclude>petclinic-spring/**</exclude>
<!-- Javascrip Libraries -->
<exclude>**/jquery*</exclude>
<exclude>**/angular*</exclude>
<exclude>**/qunit*</exclude>
<exclude>**/backbone*</exclude>
<exclude>**/lodash*</exclude>
<exclude>**/modernizr*</exclude>
<exclude>**/yepnope*</exclude>
<exclude>**/mobile-nav*</exclude>
<!--Other libraries -->
<exclude>**/*glyphicons*/**</exclude>
<exclude>**/*cordova*/**</exclude>
</excludes>
<encoding>UTF-8</encoding>
<headerDefinitions>
<headerDefinition>dist/headerdefinition.xml</headerDefinition>
</headerDefinitions>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- All the modules that require nothing but JBoss Enterprise
Application Platform or JBoss EAP -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>default</name>
<value>!disabled</value>
</property>
</activation>
<modules>
<!-- All the modules that require nothing but JBoss Enterprise
Application Platform or JBoss EAP -->
<module>app-client</module>
<module>bean-validation</module>
<module>bean-validation-custom-constraint</module>
<module>bmt</module>
<module>cdi-alternative</module>
<module>cdi-decorator</module>
<module>cdi-interceptors</module>
<module>cdi-injection</module>
<module>cdi-portable-extension</module>
<module>cdi-stereotype</module>
<module>cdi-veto</module>
<module>ejb-asynchronous</module>
<module>ejb-in-ear</module>
<module>ejb-in-war</module>
<module>ejb-remote</module>
<module>ejb-security</module>
<module>ejb-security-interceptors</module>
<module>ejb-throws-exception</module>
<module>ejb-timer</module>
<module>ejb-multi-server</module>
<module>greeter</module>
<module>helloworld</module>
<module>helloworld-jms</module>
<module>helloworld-mbean</module>
<module>helloworld-mdb</module>
<module>helloworld-mdb-propertysubstitution</module>
<module>helloworld-rs</module>
<module>helloworld-singleton</module>
<module>helloworld-ws</module>
<module>hibernate3</module>
<module>hibernate4</module>
<module>kitchensink</module>
<module>kitchensink-ear</module>
<module>kitchensink-jsp</module>
<module>kitchensink-ml</module>
<module>kitchensink-ml-ear</module>
<module>log4j</module>
<module>logging</module>
<module>logging-tools</module>
<module>mail</module>
<module>numberguess</module>
<module>payment-cdi-event</module>
<module>picketlink-sts</module>
<module>servlet-async</module>
<module>servlet-filterlistener</module>
<module>servlet-security</module>
<module>shopping-cart</module>
<module>tasks</module>
<module>tasks-jsf</module>
<module>tasks-rs</module>
<module>temperature-converter</module>
<module>websocket-hello</module>
<module>xml-dom4j</module>
<module>xml-jaxp</module>
</modules>
</profile>
<profile>
<!-- All the quickstarts that require Postgres to be running -->
<id>requires-postgres</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>requires-postgres</name>
<value>!disabled</value>
</property>
</activation>
<modules>
<module>cmt</module>
<module>jts</module>
</modules>
</profile>
<profile>
<!-- All the quickstarts that have weird requirements around deployment that Maven can't handle -->
<id>complex-dependencies</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>complex-dependencies</name>
<value>!disabled</value>
</property>
</activation>
<modules>
<module>cluster-ha-singleton</module>
<module>inter-app</module>
<module>jax-rs-client</module>
<module>jts</module>
</modules>
</profile>
<profile>
<!-- All the quickstarts that require the "standalone-full" profile
to be in use -->
<id>requires-full</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>requires-full</name>
<value>!disabled</value>
</property>
</activation>
<modules>
<module>helloworld-mbean</module>
<module>helloworld-mdb</module>
<module>helloworld-mdb-propertysubstitution</module>
<module>jta-crash-rec</module>
</modules>
</profile>
<profile>
<!-- All the quickstarts that require the xts to be enabled -->
<id>requires-xts</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>requires-xts</name>
<value>!disabled</value>
</property>
</activation>
<modules>
<module>wsat-simple</module>
<module>wsba-coordinator-completion-simple</module>
<module>wsba-participant-completion-simple</module>
</modules>
</profile>
<profile>
<!-- All the quickstarts that don't actually use Maven. Don't
activate this profile! We just include this for completeness. -->
<id>non-maven</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<modules>
<module>forge-from-scratch</module>
<module>h2-console</module>
<module>jts-distributed-crash-rec</module>
</modules>
</profile>
</profiles>
A couple of ideas to try:
- Try building your project from the command line, to make sure all is well that way.
- It looks like you're using a 'quickstart', which is a great idea. These work best if they are in the original directory (with the rest of the other quickstarts), it helps get the parent resolution right.
- If you're afraid of making your quickstart directory 'dirty' with your own applications, don't be. It's easy to make a copy of an existing quickstart as a base to build your app on. Just give them all a unique name prefix (to help organization) and name it likewise in the Maven GAV in the pom.xml.
jboss-parent pom is available through Maven Central at https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/8/
I am wondering why it doesn't resolve for you. Maybe try to build on command line as already suggested and force Maven to update.

Recreation of entity classes

I try to run a web application with hibernate, spring and jpa on netbeans 8.0.1, but now I'm stuck on this exception when compiling app...Here's the error below:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default- compile) on project SMSXxxxx: Compilation failure: Compilation failure:
error: Problem with Filer: Attempt to recreate a file for type com.equitel.smsmanager.entities.TextMessageContent_
error: Problem with Filer: Attempt to recreate a file for type com.smsmanager.entities.SmsUser_
Here is the persistence unit, I have only one in my project
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="SMSManagerPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jboss/datasources/SMSManagerDS</jta-data-source>
<class>com.smsmanager.entities.Approval</class>
<class>com.smsmanager.entities.Changelog</class>
<class>com.smsmanager.entities.Contacts</class>
<class>com.smsmanager.entities.Dispatches</class>
<class>com.smsmanager.entities.MessageSchedule</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
I have not managed to fix this error , could you help me fix this?
For some reasons, there is a dependency in pom.xml that in my case caused the problem. Look for it and delete it:
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>hibernate-jpamodelgen-4.3.1.Final</artifactId>
<version>SNAPSHOT</version>
<scope>provided</scope>
</dependency>
This could be a bug in Netbeans.
https://netbeans.org/bugzilla/show_bug.cgi?id=183779
Check your pom.xml file maven-compiler-plugin is added or not. If it is not there add plugin as shown in below.
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
You can find root cause by using mvn clean install -X in cmd prompt.
Check in your pom.xml file the version of java mentioned there and check which version of java is mentioned in the $JAVA_HOME
environment variable . Both should be the same.
Check this also
May be its Java Compiler issue.
May be issue with downloading the jar
The solution that worked for me:
Try to remove the :
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>hibernate-jpamodelgen-4.3.1.Final</artifactId>
<version>SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Then add a maven profile with activation and dependency
<profiles>
<profile>
<id>profile-JPA-Gen</id>
<activation>
<property>
<name>activate_gen</name>
<value>true</value>
</property>
</activation>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>SNAPSHOT</version>
</dependency>
</profile> </profiles>
Run once mvn install -P profile-JPA-Gen only to generate the relevant classes, and then use mvn clean install.

ClassNotFoundException when deploying multi-module POM project (EAR) to WTP

Eclipse version: Indigo
Target Application server: Weblogic 10.3.5 (11gR1)
I am having trouble building and deploying a multi-module POM project (packaged as an EAR) to my WebLogic server, within Eclipse.
Despite the parent POM building an EAR file successfully outside of the IDE, I am receiving the following error when trying to deploy the UI WAR to the Application Server:
java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:486)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3027)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:341)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: weblogic.application.ModuleException: Failed to load webapp: 'lerp-ui'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processServlets(WebAnnotationProcessorImpl.java:225)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processJ2eeAnnotations(WebAnnotationProcessorImpl.java:209)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:105)
at weblogic.servlet.internal.WebAppServletContext.processAnnotations(WebAppServletContext.java:1368)
at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:449)
at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:493)
at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:418)
at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:972)
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:382)
This is despite having the jsf-api dependency in both the Maven POM and referenced in the .classpath file for the UI WAR project:
Snippet of the POM for the UI WAR project:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3</version>
</dependency>
.classpath for UI WAR Project:
<classpathentry kind="var" path="M2_REPO/javax/faces/jsf-api/2.0.3/jsf-api-2.0.3.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/faces/jsf-impl/2.0.3/jsf-impl-2.0.3.jar"/>
Below follows the entire parent POM of the multi-module project:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.co.acme</groupId>
<artifactId>multiModulePOMProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>acme troublesome project</name>
<modules>
<module>../../Business/common</module>
<module>../../Business/svccom</module>
<module>../../Business/busctl</module>
<module>../../Client/ui</module>
<module>../../Business/ear</module>
<module>../../Business/talend/java/businessrules</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.ui.version>1.0-SNAPSHOT</project.ui.version>
<project.common.version>1.0-SNAPSHOT</project.common.version>
<project.svccom.version>1.0-SNAPSHOT</project.svccom.version>
<project.busctl.version>1.0-SNAPSHOT</project.busctl.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<webapp.filter>development</webapp.filter>
<spring.version>3.0.5.RELEASE</spring.version>
<eclipselink.version>2.1.3</eclipselink.version>
<persistence.version>2.0.0</persistence.version>
<spring.cdi.version>1.0.0</spring.cdi.version>
<weblogic.adminurl>t3://localhost:7050</weblogic.adminurl>
<weblogic.user>weblogic</weblogic.user>
<weblogic.password>welcome1</weblogic.password>
<weblogic.target>acmeLocalDomain</weblogic.target>
<weblogic.source>../../Business/ear/target/${parent.artifactId}.${packaging}</weblogic.source>
</properties>
<profiles>
<profile>
<id>production</id>
<properties>
<webapp.filter>production</webapp.filter>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
</plugin>
</plugins>
</build>
</project>
It's clear that this is some classpathing issue, but I have gone scrollbind from staring at it over the course of two days and have decided that the time has come to wave the white flag and appeal for help!
The end goal is to take my EAR project (which currently is hampered from an annoying need to undeploy/redeploy on the command line for every little change) and get it so that I can perform hot fixes within a deployment which is run inside the IDE.
Thanks
Update:
By adding the offending dependency to the domains\<domain>\lib folder of the application server, and restarting the application server, I have now started getting ClassNotFoundExceptions for other WAR dependencies. It is clear now that Eclipse is not respecting the classpath of the WAR project - and I still don't understand why or how :-(
To package dependencies into your lib directory, add this to your EAR packaging pom:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
[Your EJB and Web modules here]
</modules>
</configuration>
</plugin>
</plugins>
</build>
Notice the defaultLibBundleDir tag.
After building the EAR using File > Export in Eclipse, I was able to compare the EAR to the one produced by my Maven POM.
I found that Eclipse did not contain references to the Maven Dependencies build path items in the Deployment Assembly (I discovered that simply adding the Projects as dependencies wasn't enough).
Reading around the subject, I found that it was neccessary to add the Maven Dependencies of the child WAR and JARs to their respective WAR and JAR projects, but with a destination of
../lib
This is declared on each WAR and JAR refers to the lib folder of the parent EAR.
Using a combination of this menu (and alternatively by editing each of the corresponding .settings/org.eclipse.wst.common.component files for each affected WAR and JAR in turn) I was able to build up a version of the EAR which matched the one produced via my Maven script.
I hope this helps someone.

Can I access Maven properties as variables in Eclipse?

I have a Maven project that derives the path to a native library using properties which can be set in local profiles. For example:
<project>
...
<build>
...
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<LD_LIBRARY_PATH>${foo.libdir}</LD_LIBRARY_PATH>
</environmentVariables>
<fork>always</fork>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>foo-default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<foo.libdir>/usr/local/lib</foo.libdir>
</properties>
</profile>
</profiles>
</project>
When I'm working with this project in Eclipse using the M2Eclipse plugin, I'd like to be able to set up run configurations that also reference this path in the same was (e.g., so I can run the Eclipse debugger on the project). Is there a way to access the Maven property from Eclipse, e.g., so that could set LD_LIBRARY_PATH in the run configuration using a variable like ${maven_property:foo.libdir}?
I do not think so.
Your maven script could refer to environment variable that you could define in the environment tab of your launch configuration
But the other way around (i.e. your configuration resolving at launch time some maven script property) is not, as far as I know, possible.