Maven breaks resource stream to jpg once exported to runnable jar - eclipse

I've been seen searching high and low for a solution to my problem with maven (which I'm inexperienced with) including various plugins and resource declarations, all unsuccessful. I'm using JavaFX in my application and loading this image works great in eclipse but breaks once exported to a runnable jar. I'm assuming this has something to do with the way maven packages the jar.
public void initialize(){
Image image = new Image(this.getClass().getResourceAsStream("pcoordinatesImage.jpg"));
diagramImage.setImage(image);
}
I get a NullPointerException: "input must not be null" when executing the jar on command line
I've swapped out more plugins than a glade air freshener in my pom.xml file. I posted the whole pom.xml so you guys can see how little I know and maybe spot some obvious errors
<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>EllipsoidCalculation</groupId>
<artifactId>EllipsoidCalculation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>ellipsoidCalc.EllipsoidCalcMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The resources are right next to the source code where I want them when I export to a jar so I have no idea why is doesn't work
Thanks for any help!
Heres the contents of my runnable jar file:
command line

I regret to admit that I found the bug. The "p" in "pcoordinatesImage.jpg" should be capitalized as shown in the screen shot of the command line. That fixed the problem. Oddly enough it didn't break the code in eclipse tho. So anyone else suffering from the same problem, check caps. The pom.xml that was posted appears to be functional, hope it helps

Related

NetBeans Maven Project jar file not executing

For some reason when I clean and build my maven project in NetBeans, the resulting jar file does not execute when clicked. I've tried altering the pom file several times, here is what it looks like now:
<?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">
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>mainWindow.java</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>corp1</id>
<name>Corporate Repository</name>
<url>file:///EGR-1L11QD2/CLS_lab/fitbir_access_project</url>
<layout>default</layout>
</repository>
</distributionManagement>
<modelVersion>4.0.0</modelVersion>
<groupId>cls.lab</groupId>
<artifactId>fitbir_access</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.24</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
My application is connected to a MySQL database, I'm not sure if that has something to do with it.
Edit: Tried to run the following line in both Administrator: Windows PowerShell and Command Prompt, both with the same error "Could not find or load main class: mainWindow.java":
java -jar fitbir_access-1.0-SNAPSHOT-jar-with-dependencies.jar
Here is MANIFEST.MF Properties:
And here is what I get when I try to open MANIFEST.MF:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: audra
Build-Jdk: 16.0.1
Main-Class: mainWindow.java
Edit 2: Here is the file location for mainWindow.java: C:\Users\audra\OneDrive\Documents\NetBeansProjects\FITBIR\src\main\java\cls_lab\mainWindow.java
Compile classpath: C:\Users\audra.m2\repository\mysql\mysql-connector-java\8.0.24\mysql-connector-java-8.0.24.jar;C:\Users\audra.m2\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;C:\Users\audra.m2\repository\com\h2database\h2\1.4.200\h2-1.4.200.jar;C:\Users\audra\OneDrive\Documents\NetBeansProjects\fitbir\target\classes
Runtime classpath: C:\Users\audra\OneDrive\Documents\NetBeansProjects\fitbir\target\classes;C:\Users\audra.m2\repository\mysql\mysql-connector-java\8.0.24\mysql-connector-java-8.0.24.jar;C:\Users\audra.m2\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;C:\Users\audra.m2\repository\com\h2database\h2\1.4.200\h2-1.4.200.jar
And the boot classpath is like a page long so I won't post it unless it's necessary.
Edit 3: I changed the file locations so everything is under NetBeansProjects\fitbir (with lowercase letters), but this did not solve anything. I also changed the main class name in the pom file to cls_lab.mainWindow.java so that it is now the fully qualified class name, but I still have the same error when I run it through command prompt: Can not find or load main class.

AspectJ annotations are not working in JAVA maven project (Not spring project)

I'm trying to implement AspectJ annotations in JAVA maven project without spring. I have added Aspects and create annotation. But its not invoking the Aspects where i have added as Annotation to the method..Below is my code..Also the project link - https://github.com/chandru-kumar/aop-example
I have added aspectj maven plugin as well..But its not getting invoked..Can you pls help..? Not sure what I'm missing.
I haven't found any example without Spring project..
Pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aop.example</groupId>
<artifactId>aop-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjrt -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
</executions>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
com.aop.example.Test
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
JAVA - Aspects - Advice
package com.aop.advices;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
public class SysoutAdvice {
#Around("#annotation(com.annotations.Sysout)")
public Object print(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
System.out.println("Start....");
Object object = proceedingJoinPoint.proceed();
System.out.println("End....");
return object;
}
}
JAVA - Annotation
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
#retention(RUNTIME)
#target(METHOD)
public #interface Sysout{}
I can tell that you are an AspectJ beginner. You made many mistakes. But do not worry, you are going to learn and get more experience over time.
Annotation must have RUNTIME scope
Otherwise the compiled code will not have an annotation to intercept, only the source code, which does not help.
Aspect must have #Aspect annotation
Otherwise the AspectJ compiler will not identify the class as an aspect.
Avoid double log output
If you do not add && execution(* *(..)), the aspect will intercept both call and execution joinpoints. The effect would be double log messages, because the aspect advice is triggered twice.
Add missing Maven plugin execution
Otherwise the AspectJ Maven plugin does not compile anything, because you did not tell it what to do.
Delete redundant AspectJ dependencies
Otherwise the Assembly plugin will pack them into the executable JAR, blowing it up to size 13.4 MB. But actually, you only need the AspectJ runtime aspectjrt in order to run an application when using compile-time weaving. The other two are for load-time weaving (aspectjweaver) and for the AspectJ compiler (aspetjtools), both of which you do not need during runtime.
If you follow my advice to remove those two, the JAR size shrinks dramatically to 0.12 MB. That is more than a factor 100 smaller.
Make sure the old AspectJ Maven plugin uses an up-to-date AspectJ compiler
The version number should be the same as the one used for aspectjrt. So you do not need aspetjtools as a runtime dependency, but as a plugin dependency, if you want to make sure you have identical versions.
This step is optional, but AspectJ Maven 1.11 uses AspectJ Tools 1.8.13 by default. This is fine if you just compile Java 8 code, because AspectJ Maven 1.11 does not support more than Java 8.
If you want a more modern plugin supporting AspectJ 1.9.7.M3 and Java 16, please look at the dev.aspectj plugin version (please note the other Maven group ID!).
There are other suboptimal things that should be changed in your Maven configuration, but this is the most important stuff, which makes your project run and your executable JAR small.
Update: Here is my pull request which fixes the problems above and a few more (see commit comments).
Consider writing this in your pom.xml---
<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>com.aop</groupId>
<artifactId>AOPconcept</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>AOPconcept</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.9.1</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>6.0.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.9.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<complianceLevel>1.5</complianceLevel>
</configuration>
<executions>
</executions>
</plugin>
</plugins>
</build>
</project>

Maven will not export runable JAR

So I have a small maven project in eclipse, if I export a runable JAR and select:
Package required libaries into generated JAR
it works fine.
I should note that one of my JAR's is maven controlled (Univocity) the other is a local Oracle JDBC JAR. I want to include both of these in my runable JAR package so I can deploy a single JAR to production and execute it with a single command.
In my POM I added maven-assembly-plugin and when I use mvn package, I get a JAR with the Univocity library, but it skips the Oracle JAR.
How can I get it to bundle the Oracle JAR into the final output ?
Here is the POM:
<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>au.com.myco</groupId>
<artifactId>MyCoOracleExtractor</artifactId>
<version>0.0.4</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<univocity.version>2.0.0</univocity.version>
</properties>
<dependencies>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc6-11.2.0.4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>${univocity.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly:package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>au.com.myco.MyCoOracleExtractor</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I did try using maven-dependency-plugin, but it didnt solve the problem bundling them into the single JAR.
You have to install it manually because Oracle didn't let maven got any of their jars : so you got to install it manually with the command mvn install:install -Dfile=<path to file> ... and put it in your pom.xml like any other dependency without the <SystemPath> like this :
<dependencies>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
</dependecies>
In my case : when i want to deploy my application in tomcat : i got to put the jar ojdbc6 directly in the folder lib of tomcat.

Maven Webapp Project not recognizing the custom ruleset during build

I have a Maven WebApp project (Just a HelloWorld Servlet) in Eclipse and running tomcat server. My ultimate aim is to fail the build if the code contains out.print statements. I have defined the maven pmd plugin 2.5 in the pom.xml as below and defined a customized ruleset in a file called sop.xml as below.
But when I right click the project -> Run As -> Maven Build and try to package it, the build is successful and creating the war file. I want the build to fail because the .java code contains the out.print statements.
I am new to Maven and requesting all your kind help on this regard. Thanks.
Ruleset file(sop.xml):
<?xml version="1.0"?>
<ruleset name="Custom ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>This ruleset checks my code for println statements</description>
<rule ref="rulesets/JavaLogging.xml" message="Must handle exceptions">
</rule>
</ruleset>
POM.xml
<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>MavenWebGroupId</groupId>
<artifactId>MavenWebArtifactId</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>MavenWebName</name>
<description>MavenWebDescription</description>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<skip>false</skip>
<targetJdk>${compile.source}</targetJdk>
<rulesets>
<!-- Custom local file system rule set -->
<ruleset>c:\rulesets\sop.xml</ruleset>
</rulesets>
<linkXref>true</linkXref>
<failOnViolation>true</failOnViolation>
</configuration>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>build</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
</project>
Looks like maven-pmd-plugin doesn't executed during packaging. To calling this plugin during packaging define it as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
...
</configuration>
<dependencies>
...
</dependencies>
<executions>
<execution>
<id>run-pmd</id>
<phase>prepare-package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Note to <executions> tag.

Eclipse with Websphere 7.0.0.17: EJB project does not work with resources within the workspace, but works with resources on Server

My application works with Maven and has three modules:
ear-module
web-module
ejb-module
EJB Version is 3.0.
Deployment works in both ways without error messages.
When I try to run the application with the Publishing settings for Websphere "Run server with resources on Server" it works fine.
When I try do the same with "Run server with resources within the workspace" and open the application in my Browser it fails with this error message:
A resource reference binding could not be found for the following resource references [jdbc/nust], defined for the NustService component.
I am new in JEE5, but it seems to me that local the websphere cant find the ejb-jar.xml.
Here the pom for ejb modul:
<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>
<artifactId>mycomp-nust-frontend-app</artifactId>
<groupId>mycomp.app</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>mycomp-nust-frontend-svc</artifactId>
<name>mycomp-nust-frontend-svc</name>
<packaging>ejb</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mycomp.service</groupId>
<artifactId>mycomp-service-utils</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- Add classpath container for Websphere Application Server 7 to the
Eclipse project. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jst.server.core.container/com.ibm.ws.ast.st.runtime.runtimeTarget.v70/was.base.v7</classpathContainer>
<classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer>
</classpathContainers>
<projectNameTemplate>${project.name}</projectNameTemplate>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any suggestions, more info needed?
thx
The problem is not with your ejb-jar.xml. Remember, the ejb-jar.xml just declares references; the actual binding to a "real" resource is done by application server-specific files. In WebSphere's case, this file is ibm-ejb-jar-bnd.xml, which should be located at the same directory as ejb-jar.xml. Do you happen to have that file there?
I faced a similar situation where my application's defined resources could not be found. The solution was to define the /WEB-INF/ibm-web-bnd.xmi
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.ejs.models.base.bindings.webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1348167502046" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#struts_blank"/>
<resRefBindings jndiName="jms/MyConnectionFactory" xmi:id="cf">
<bindingResourceRef href="WEB-INF/web.xml"/>
</resRefBindings>
<messageDestinationRefBindings jndiName="jms/TopicSpace/Group/Test" xmi:id="myTopic">
<bindingMessageDestinationRef href="WEB-INF/web.xml"/>
</messageDestinationRefBindings>
</com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding>
A senior developer in the team said that this should be a XML file but then that didn't work. I discovered this by exporting a deployed application from an IBM tutorial. Depending on your application you will have to change the above resource references.
Hope this helps