I have a web service WebService1 that is deployed on JBoss (4.2.3.GA).
WebService1's endpoint is Endpoint1.
I wrote a WebService2 which dependends on WebService1. When Maven creates the .EAR file, it places the .JAR with WebService1 in WebService2's .EAR.
So, when I deploy WebService2 in JBoss I get the exception:
Endpoint1 has already registered.
If I remove class with Endpoint1 from the .JAR in the .EAR, then it's all normally deployed. But I can't remove this class after every project building.
Any ideas?
If you have a dependency that you don't want packaged with your maven build, use the "provided" dependency scope like this:
<dependency>
..
<scope>provided</scope>
..
</dependency>
This will allow Maven to compile the project, but won't include said dependency with the final package. More information here.
Is this what you were looking for?
Related
I'm trying to make a sign operation with a XML file. In this process, I use the xmlSec 1.5 library. If I run the code in a local test the process finishes successfully.
However, if I deploy the code in a war in a Jboss 7.1, my dependency with xmlSec 1.5 is override by Jboss by its module dependency "xmlsec-2.0.8.redhat-1", and the sign process fails.
For client's petition, I can exclude the xmlsec Jboss module, but I cannot use it to sign.
So, the problem is: how could I specify a given library version to be used only in a part of the code?.
In this case, the path of both dependencies are the same: org.apache.santuario, so, I cannot use it in order to specify the library.
I'm trying to use a provider for signing, but, again, Jboss override my xmlsec-1.5 security provider for its xmlsec-2.0.8 security provider. There exists some way to instanciate a provider and adds it to the set of java providers in order to replace the Jboss one?
You can exclude the JBoss provided dependency using jboss-deployment-structure.xml file which you need to place under the WEB-INF directory of your war. You have to specify the exclusion dependencies something like below.
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="$LIBRARY_OR_MODULE_YOU_WANT_TO_EXCLUDE"/>
</exclusions>
</deployment>
e.g. <module name="org.apache.santuario.xmlsec"/>
My project has many jars. Two jars have a specific class with same name. Both the jar contains a class named Response. One of the Response class in jar A has a method abc(). I am creating the reference of this class in a Service class and calling this method abc(). When I generate the war file using maven and run the project in my local system Tomcat which is integrated with the Eclipse, the method is found and there is no exception. But when I deploy the same war file in external AWS Tomcat, I am getting java.lang.NoSuchMethodError. This must be because in the war file, the reference must belong to the class in another jar which does not have the method abc(). I cannot remove these classes as both are used.
Help.
If you want only A's class to be included inside your uber jar, I believe you can exclude the class from jar B to be wrapped up inside you uber jar by using something along the lines of the following directive inside yuor POM file :-
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</exclusion>
</exclusions>
</dependency>
The above directive will include all the dependency jars inside hadoop client core jar except for the commons-math3, so if you want to use a newer version (or say different version) of apache commons-math3, you can add that explicitly as a dependency inside your POM without having to worry about if the commons-math3 from hadoop core library would be wrapped up inside your uber jar
We created client for web-service with security policy to call the other web-service by passing the required information like username,password and other information..Jdeveloper had given the support for security policy and their packages but to create the war and building the application we are using maven.
when we compile through maven it is giving the compilation errors.
Can any one suggest is there any plug in to add in the maven to compile the code..
Please click below link to see the image of compilation error :
Compilation errors in console when we run Maven
The Package weblogic.wsee.jws.jaxws.owsm is part of weblogic middleware and is installed on the modules folder.
You can add it to your maven repository for example Nexus as:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ws.api</artifactId>
<version>1.1.0.0</version>
</dependency>
The file is %MW_HOME%\modules\ws.api_1.1.0.0.jar
or, of course, if you don't want the hassle of going through adding artifacts to the repository:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ws.api</artifactId>
<version>1.1.0.0</version>
<scope>system</scope>
<systemPath>${mw.home}/modules/ws.api_1.1.0.0.jar</systemPath>
</dependency>
I'm trying to extend some features to the scim api that are not supported.
I've added the following maven dependencies from WSO2 Nexus repository:
<dependency>
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim</groupId>
<artifactId>identity-inbound-provisioning-scim</artifactId>
<version>5.1.4-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim</groupId>
<artifactId>org.wso2.carbon.identity.scim.provide</artifactId>
<version>5.1.4-SNAPSHOT</version>
<type>war</type>
<classifier>classes</classifier>
</dependency>
I've identified that I need to change the org.wso2.carbon.identity.scim.provider.resources.SCIMUserManager (and its UserStoreManager), and also add a new endpoint in the org.wso2.carbon.identity.scim.provider.resources.UserFeature.
However, these are located within org.wso2.carbon.identity.scim.provider but it seems that the war dependency hasn't any classes attached (and the maven 'classifier' tag is in vain), therefore I can't import or inherit those classes.
So, how can I extend the SCIM Api by using the org.wso2.carbon.identity.scim.provider library but managed by Maven?
I may not understand your question well. Anyway, You can change scim endpoint (wso2.war) file and put into repository/deployment/server/webapp directory. Also, you can find the class inside WEB-INF directory.
I am working on dropwizard-maven project.How can we convert the jar file to war file and deploy it in tomcat server.If anyone knows,kindly help.
You cannot just simply convert a jar file to a war file. A Web archive has a structure to be followed and there is no straight forward way to convert the type.
What you can do is, create a web application, import the jar file as dependency and make endpoints in the webapp to trigger calls in the jar you have.
You might need to take a look into why you are using dropwizard, if you are planning to deploy it in a tomcat server.
You might find the below link helpful.
https://github.com/twilio/wiztowar
Add maven war plugin in your pom.xml and run command clean install to generate war file.
You should try wizard in a box, it will let you deploy a Dropwizard application to a Tomcat container as a war.
In the case of a Spring project, Add this to pom.xml.
<packaging>war</packaging>
Not related to drop wizard, but if you are having a Spring boot project and you came here from google, this is what you should do.
Change the packaging to WAR
<packaging>war</packaging>
Mark the tomcat embedded server as provided
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope> <!-- This is important. -->
</dependency>
Make your #SpringBootApplication extend SpringBootServletInitializer
#SpringBootApplication
public class HelloWorldApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(HelloWorldApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(HelloWorldApplication.class);
}
}
I have a detailed article about Converting Jar to War