apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.59k stars 835 forks source link

Cannot be generated because EJB Lite classes are not available on project classpath. #6087

Open hhallenyang opened 1 year ago

hhallenyang commented 1 year ago

Apache NetBeans version

Apache NetBeans 18

What happened

After successfully created Entity classes from Database, I try to create New JSF Pages from Entity Classes. I can see the Entity Classes and I could move them to the Selected Entity Classes panel. I need to select Finish command to create the JSF Pages. However, Finish command is disabled. I see this error message "Cannot be generated because EJB Lite classes are not available on project classpath." in red at the bottom.

How to reproduce

Step 1: Create a new web application project by clicking "Java with Maven" -> "Web Application", then select project name and location as usual. In Setting, select GlassFish server version 7.0.5 and Java EE 10 web. Then I created the project. After that, I added dependencies in POM file as below.

Step 2: <?xml version="1.0" encoding="UTF-8"?>

4.0.0 TestGroup com.mycompany 1.0-SNAPSHOT com.mycompany mavenproject3 1.0-SNAPSHOT war mavenproject3-1.0-SNAPSHOT 11 11 ${project.build.directory}/endorsed UTF-8 false 10.0.0 org.apache.tomee jakartaee-api 10.0-M1 jakarta.servlet.jsp jakarta.servlet.jsp-api 3.1.0 jakarta.platform jakarta.jakartaee-web-api ${jakartaee} provided org.glassfish jakarta.faces 4.0.2 jakarta.faces jakarta.faces-api 4.0.1 jakarta.faces j 4.0.1 jakarta.platform jakarta.jakartaee-api ${jakartaee} provided jakarta.xml.bind jakarta.xml.bind-api 2.3.3 jakarta.persistence jakarta.persistence-api 3.0.0 jakarta.inject jakarta.inject-api 2.0.1 jakarta.ejb jakarta.ejb-api 4.0.1 jakarta.enterprise jakarta.enterprise.cdi-api 2.0.2 provided jakarta.enterprise jakarta.enterprise.lang-model 4.0.1 org.hibernate hibernate-search-orm 5.11.12.Final org.eclipse.persistence org.eclipse.persistence.core 3.0.3 org.eclipse.persistence org.eclipse.persistence.asm 9.2.0 org.eclipse.persistence org.eclipse.persistence.antlr 2.7.12 org.eclipse.persistence org.eclipse.persistence.jpa 3.0.3 org.eclipse.persistence org.eclipse.persistence.jpa.jpql 3.0.3 org.eclipse.persistence org.eclipse.persistence.moxy 3.0.3 org.eclipse.persistence jakarta.persistence 2.2.3 org.eclipse.persistence org.eclipse.persistence.jpa.modelgen.processor 3.0.3 provided org.glassfish.main.core glassfish 6.2.5 org.glassfish.main.common glassfish-api 5.0 org.apache.maven.plugins maven-compiler-plugin 3.8.1 11 11 ${endorsed.dir} org.apache.maven.plugins maven-war-plugin 3.3.1 false org.apache.maven.plugins maven-dependency-plugin 2.6 validate copy ${endorsed.dir} true jakarta.platform jakarta.jakartaee-api ${jakartaee} jar

Step 3: Connect to MySQL database and created entity classes from my database successfully.

Step 4: I want to create JSF pages from Entity Classes but I could not do it because of the error message I mentioned.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 10

JDK

Open JDK17

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

THis happen everytime.

Are you willing to submit a pull request?

No

asbachb commented 1 year ago
  1. Please fix the XML in your bug report.
  2. Can you share the CREATE TABLE and INSERT INTO sql statements.
  3. Are there any Exceptions or just nothing happen? Your dependencies in pom.xml looks a little bit weird. Not 100% sure if it causes some issues when you have jakartaee-api and jakarta.jakartaee-web-api with different versions.
hhallenyang commented 1 year ago

Thanks a lot for the response.

I am sorry I did not include the complete POM file. Here is the complete POM file content.

<?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>
    <parent>
    <artifactId>TestGroup</artifactId>
    <groupId>com.mycompany</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
    <groupId>com.mycompany</groupId>
    <artifactId>testing</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>testing-1.0-SNAPSHOT</name>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <jakartaee>10.0.0</jakartaee>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.servlet.jsp</groupId>
            <artifactId>jakarta.servlet.jsp-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jakarta.platform/jakarta.jakartaee-web-api -->
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-web-api</artifactId>
            <version>${jakartaee}</version>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.glassfish/jakarta.faces -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.faces</artifactId>
            <version>4.0.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/jakarta.faces/jakarta.faces-api -->
        <dependency>
            <groupId>jakarta.faces</groupId>
            <artifactId>jakarta.faces-api</artifactId>
            <version>4.0.1</version>
        </dependency>

        <dependency>
            <groupId>jakarta.faces</groupId>
            <artifactId>j</artifactId>
            <version>4.0.1</version>
        </dependency>

        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>${jakartaee}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>2.3.3</version>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <version>4.0.1</version>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <version>2.0.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.lang-model</artifactId>
            <version>4.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search-orm</artifactId>
            <version>5.11.12.Final</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.core</artifactId>
            <version>3.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.asm</artifactId>
            <version>9.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.antlr</artifactId>
            <version>2.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa</artifactId>
            <version>3.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.jpql</artifactId>
            <version>3.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.moxy</artifactId>
            <version>3.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>jakarta.persistence</artifactId>
            <version>2.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
            <version>3.0.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.main.core</groupId>
            <artifactId>glassfish</artifactId>
            <version>6.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.main.common</groupId>
            <artifactId>glassfish-api</artifactId>
            <version>5.0</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>jakarta.platform</groupId>
                                    <artifactId>jakarta.jakartaee-api</artifactId>
                                    <version>${jakartaee}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I removed jakartaee-api from the POM file, just keep jakarta.jakartaee-web-api in it.

This section removed

<dependency>
        <groupId>org.apache.tomee</groupId>
        <artifactId>jakartaee-api</artifactId>
        <version>10.0-M1</version>
</dependency>

Here is the SQL statements

CREATE DATABASE  IF NOT EXISTS `testing` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `testing`;
-- MySQL dump 10.13  Distrib 8.0.11, for Win64 (x86_64)
--
-- Host: 127.0.0.1    Database: testing
-- ------------------------------------------------------
-- Server version   8.0.4-rc-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
 SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `contact`
--

DROP TABLE IF EXISTS `contact`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `contact` (
  `id` bigint(20) NOT NULL,
  `short_id` int(11) DEFAULT NULL,
  `locked` tinyint(1) NOT NULL,
  `lock_owner` bigint(20) DEFAULT NULL,
  `lock_time` datetime DEFAULT NULL,
  `orgnization_name` varchar(200) DEFAULT NULL,
  `emergency_contact` tinyint(1) DEFAULT '0',
  `informant` tinyint(1) DEFAULT '0',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `last_name` varchar(30) DEFAULT NULL COMMENT 'Last name of the person.',
  `first_name` varchar(15) DEFAULT NULL COMMENT 'First name of the person.',
  `middle_name` varchar(30) DEFAULT NULL COMMENT 'Middle name or middle initial of the person.',
  `suffix` varchar(10) DEFAULT NULL,
  `prefix_name` varchar(10) DEFAULT NULL,
  `professional_suffix` varchar(200) DEFAULT NULL,
  `npi` char(10) DEFAULT NULL,
  `combined_name_string` varchar(200) DEFAULT NULL,
  `combined_id_string` varchar(200) DEFAULT NULL,
  `combined_address` varchar(4000) CHARACTER SET utf8 DEFAULT NULL,
  `line1` varchar(200) DEFAULT NULL COMMENT 'First street address line.',
  `line2` varchar(60) DEFAULT NULL COMMENT 'Second street address line.',
  `city` varchar(30) DEFAULT NULL COMMENT 'Name of the city.',
  `state` varchar(3) DEFAULT NULL COMMENT 'Unique identification number for the state or province. Foreign key to StateProvince table.',
  `zip` varchar(12) DEFAULT NULL COMMENT 'Postal code for the street address.',
  `direction` text,
  `phone_main_area_code` varchar(3) DEFAULT NULL,
  `phone_main_number` varchar(21) DEFAULT NULL,
  `phone_main_extension` varchar(5) DEFAULT NULL,
  `phone_main_combined_number` varchar(21) DEFAULT NULL,
  `phone_main_combined_string` varchar(200) DEFAULT NULL,
  `phone_main_note` varchar(200) DEFAULT NULL,
  `phone_secondary_number` varchar(21) DEFAULT NULL,
  `phone_secondary_extension` varchar(5) DEFAULT NULL,
  `phone_secondary_combined_number` varchar(21) DEFAULT NULL,
  `phone_secondary_combined_string` varchar(200) DEFAULT NULL,
  `phone_secondary_note` varchar(200) DEFAULT NULL,
  `phone_alternate_area_code` varchar(3) DEFAULT NULL,
  `phone_alternate_number` varchar(21) DEFAULT NULL,
  `phone_alternate_extension` varchar(5) DEFAULT NULL,
  `phone_alternate_combined_number` varchar(21) DEFAULT NULL,
  `phone_alternate_combined_string` varchar(200) DEFAULT NULL,
  `phone_alternate_note` varchar(200) DEFAULT NULL,
  `email_address` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `contact`
--

LOCK TABLES `contact` WRITE;
/*!40000 ALTER TABLE `contact` DISABLE KEYS */;
/*!40000 ALTER TABLE `contact` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping routines for database 'testing'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-06-19  9:14:14

Here is the output image with the error message. I did not see any exception other than the error message.

EJB Lite Classes warning

Thanks again!

hhallenyang commented 1 year ago

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 TestGroup com.mycompany 1.0-SNAPSHOT com.mycompany testing 1.0-SNAPSHOT war testing-1.0-SNAPSHOT 11 11 ${project.build.directory}/endorsed UTF-8 false 10.0.0 jakarta.servlet.jsp jakarta.servlet.jsp-api 3.1.0 jakarta.platform jakarta.jakartaee-web-api ${jakartaee} provided org.glassfish jakarta.faces 4.0.2 jakarta.faces jakarta.faces-api 4.0.1 jakarta.faces j 4.0.1 jakarta.platform jakarta.jakartaee-api ${jakartaee} provided jakarta.xml.bind jakarta.xml.bind-api 2.3.3 jakarta.persistence jakarta.persistence-api 3.0.0 jakarta.inject jakarta.inject-api 2.0.1 jakarta.ejb jakarta.ejb-api 4.0.1 jakarta.enterprise jakarta.enterprise.cdi-api 2.0.2 provided jakarta.enterprise jakarta.enterprise.lang-model 4.0.1 org.hibernate hibernate-search-orm 5.11.12.Final org.eclipse.persistence org.eclipse.persistence.core 3.0.3 org.eclipse.persistence org.eclipse.persistence.asm 9.2.0 org.eclipse.persistence org.eclipse.persistence.antlr 2.7.12 org.eclipse.persistence org.eclipse.persistence.jpa 3.0.3 org.eclipse.persistence org.eclipse.persistence.jpa.jpql 3.0.3 org.eclipse.persistence org.eclipse.persistence.moxy 3.0.3 org.eclipse.persistence jakarta.persistence 2.2.3 org.eclipse.persistence org.eclipse.persistence.jpa.modelgen.processor 3.0.3 provided org.glassfish.main.core glassfish 6.2.5 org.glassfish.main.common glassfish-api 5.0 org.apache.maven.plugins maven-compiler-plugin 3.8.1 11 11 ${endorsed.dir} org.apache.maven.plugins maven-war-plugin 3.3.1 false org.apache.maven.plugins maven-dependency-plugin 2.6 validate copy ${endorsed.dir} true jakarta.platform jakarta.jakartaee-api ${jakartaee} jar