如我的标题所述,我想知道如何结合这些技术?
我已经尝试过将JEE6-Maven-Glassfish-EJB-JSF2-Hibernate- PrettyFaces组合使用,但是问题是,无法通过pom.xml将glassfish mojarra实现替换为较新的版本,并且所包含的mojarra版本无法与prettyfaces一起使用。无论如何,在一个真实的系统上,我都会替换内部的jar以使其正常工作。
现在,我正在尝试结合使用JEE6-Maven-Tomcat-EJB-JSF2-Hibernate- Prettyfaces,但是以某种方式EJB无法正常工作。我知道Apache不会随Tomcat一起提供jsf实现,因此我在pom中为最新的mojarra实现添加了依赖项。
tomcat也有一个奇怪的行为,我尝试在上下文路径“ /”上部署一个webapp,并使用Firefox使我的tomcat主页开始加载localhost:8080,并使用chrome获得我的应用程序视图。可能是什么问题呢?
在这里您可以看到我的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.pkg</groupId> <artifactId>App</artifactId> <version>1.0</version> <packaging>war</packaging> <name>App</name> <properties> <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <netbeans.hint.deploy.server>Tomcat70</netbeans.hint.deploy.server> </properties> <repositories> <repository> <id>JBoss</id> <name>JBoss Repsitory</name> <layout>default</layout> <url>http://repository.jboss.org/maven2</url> </repository> <repository> <id>jboss-snapshot</id> <url>http://snapshots.jboss.org/maven2</url> <releases> </releases> <snapshots> </snapshots> </repository> <repository> <url>http://download.java.net/maven/2/</url> <id>hibernate-support</id> <layout>default</layout> <name>Repository for library Library[hibernate-support]</name> </repository> </repositories> <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.15</version> <exclusions> <exclusion> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> </exclusion> <exclusion> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> </exclusion> <exclusion> <groupId>com.sun.jdmk</groupId> <artifactId>jmxtools</artifactId> </exclusion> <exclusion> <groupId>com.sun.jmx</groupId> <artifactId>jmxri</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.3.0.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.5.ga</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.0.5</version> </dependency> <dependency> <groupId>com.ocpsoft</groupId> <artifactId>prettyfaces-jsf2</artifactId> <version>3.2.0</version> </dependency> <dependency> <groupId>javax.sql</groupId> <artifactId>jdbc-stdext</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.0.1B</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.1.1-b04</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.1.1-b04</version> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> <compilerArguments> <endorseddirs>${endorsed.dir}</endorseddirs> </compilerArguments> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.1</version> <executions> <execution> <phase>validate</phase> <goals> <goal>copy</goal> </goals> <configuration> <outputDirectory>${endorsed.dir}</outputDirectory> <silent>true</silent> <artifactItems> <artifactItem> <groupId>javax</groupId> <artifactId>javaee-endorsed-api</artifactId> <version>6.0</version> <type>jar</type> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> <finalName>App</finalName> </build>
为什么不只升级GlassFish Mojarra JAR?
http://forums.netbeans.org/post-97832.html#97832