glassfish icon indicating copy to clipboard operation
glassfish copied to clipboard

Refactored out the policy files and their usages

Open Ariho-Seth opened this issue 5 months ago • 16 comments

This PR ;

  • Removes policy files, ie, client.policy, security.policy

  • Removes all imports for java.security.Policy, for example Policy.getPolicy(), Policy.setPolicy(), Policy.refresh()

  • Removes all the code that instantiates java.lang.SecurityManager, for example, new SecurityManager(), System.getSecurityManager(), and System.setSecurityManager()

  • Removes all related JVM options: java.security.policy.

  • Removes all methods like refreshPolicy() & removePolicy()

Fixes https://github.com/eclipse-ee4j/glassfish/issues/25519

Ariho-Seth avatar Jul 31 '25 23:07 Ariho-Seth

Hello @dmatej, @OndroMih, please check out this PR and let me know incase of any additions

Ariho-Seth avatar Jul 31 '25 23:07 Ariho-Seth

@dmatej do we want to remove the security manager also in 7.1? Is it needed to run on Java 24 and 25?

Edit: I checked and apps still run on Java 24 and 25 even if they use Security Manager API. It just cannot be enabled. So it’s better to target this PR for 8.0 branch, where we plan to remove Security Manager support completely

@Ariho-Seth , can you rebase on branch 8.0 or cherry pick your commits to it?

OndroMih avatar Aug 01 '25 05:08 OndroMih

Ohhh yeah, I hadn't realised the milestone tag on the issue, I've seen that too, let me rebase it on the 8.0 branch

Ariho-Seth avatar Aug 01 '25 07:08 Ariho-Seth

Hello @OndroMih, I tried rebasing it onto the 8.0 branch but I was unsuccessful and when I tried running mvn clean install on the 8.0 branch, and it yielded a BUILD FAILURE saying that

Could not resolve dependencies for project org.glassfish.main.security:security-ee:glassfish-jar:8.0.0-SNAPSHOT
[ERROR] dependency: org.glassfish.exousia:exousia:jar:3.0.0-M3 (compile)
[ERROR]         org.glassfish.exousia:exousia:jar:3.0.0-M3 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced
[ERROR] dependency: org.glassfish.epicyro:epicyro:jar:3.1.0 (compile)
[ERROR]         org.glassfish.epicyro:epicyro:jar:3.1.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced

Any help? I tried uncommenting the commands in the maven.config file, but it didn't help either, saying that the: Could not resolve some dependencies i.e, Could not find artifact org.glassfish.exousia:exousia:jar:3.0.0-M3 in central (https://repo.maven.apache.org/maven2) Unresolved dependency: 'org.glassfish.concurro:concurro:jar:3.1.0-M6'

Ariho-Seth avatar Aug 01 '25 08:08 Ariho-Seth

Could not resolve dependencies for project org.glassfish.main.security:security-ee:glassfish-jar:8.0.0-SNAPSHOT
[ERROR] dependency: org.glassfish.exousia:exousia:jar:3.0.0-M3 (compile)
[ERROR]         org.glassfish.exousia:exousia:jar:3.0.0-M3 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed > ```

Any help? 

Read readme:

https://github.com/eclipse-ee4j/glassfish/blob/df025709f1482b0acbf7e240dbe876c2c4cc162b/README.md?plain=1#L53

pzygielo avatar Aug 01 '25 09:08 pzygielo

Could not resolve dependencies for project org.glassfish.main.security:security-ee:glassfish-jar:8.0.0-SNAPSHOT
[ERROR] dependency: org.glassfish.exousia:exousia:jar:3.0.0-M3 (compile)
[ERROR]         org.glassfish.exousia:exousia:jar:3.0.0-M3 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed > ```

Any help? 

Read readme:

https://github.com/eclipse-ee4j/glassfish/blob/df025709f1482b0acbf7e240dbe876c2c4cc162b/README.md?plain=1#L53

Sure, thanks, though still some dependencies are not being resolved even after running using the profile i.e, mvn clean install -Pstaging

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (generate-hk2-config) on project jnosql-jakarta-persistence-integration: Compilation failure
[ERROR] /Users/2/ariho/Programming/Opensource-Projects/glassfish/appserver/persistence/jnosql-integration/src/main/java/org/glassfish/main/jnosql/jakartapersistence/mapping/glassfishcontext/EntityValidator.java:[34,19] cannot find symbol
[ERROR]   symbol:   class SaveEntity
[ERROR]   location: interface org.eclipse.jnosql.jakartapersistence.mapping.spi.MethodInterceptor
[ERROR] 

Ariho-Seth avatar Aug 01 '25 09:08 Ariho-Seth

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (generate-hk2-config) on project jnosql-jakarta-persistence-integration: Compilation failure [ERROR] /Users/2/ariho/Programming/Opensource-Projects/glassfish/appserver/persistence/jnosql-integration/src/main/java/org/glassfish/main/jnosql/jakartapersistence/mapping/glassfishcontext/EntityValidator.java:[34,19] cannot find symbol [ERROR] symbol: class SaveEntity [ERROR] location: interface org.eclipse.jnosql.jakartapersistence.mapping.spi.MethodInterceptor

Hmmm, that would mean the published SNAPSHOT dependency on the Jakarta Data / NoSQL work resolves to an older version. @OndroMih can you take a look?

arjantijms avatar Aug 01 '25 10:08 arjantijms

Yes, currently it's not possible to build 8.0 version until https://github.com/eclipse-ee4j/glassfish/pull/25645 is merged, sorry.

OndroMih avatar Aug 01 '25 13:08 OndroMih

@Ariho-Seth , meanwhile, you can merge my branch https://github.com/OndroMih/glassfish/tree/ondromih-jakarta-data-persistence-wip-glassfish into 8.0 locally and then you should be able to build.

OndroMih avatar Aug 01 '25 13:08 OndroMih

https://github.com/eclipse-ee4j/glassfish/pull/25645 is merged, so the build of the 8.0 branch should work now.

OndroMih avatar Aug 01 '25 21:08 OndroMih

Don't do this yet, or we get into conflict with huge #25640 - it removed several files already, redundant even for GF7, and changed some things around. I am working on the PR, in few days/weeks it should be done as I need to pass the TCK too with it.

dmatej avatar Aug 01 '25 21:08 dmatej

#25645 is merged, so the build of the 8.0 branch should work now.

Hello @OndroMih, I updated my local branch too, though this time round the build is failing due to a test in SQLTraceListenerTest class, i.e, public void testSQLQueryWithListener() throws IOException, which expected an asadmin succeeded but an exception was thrown, ie

<remote failure: Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 5.0.0-B09.v202507111153-40df9e5d15636cd7801cd5f26058b0963b6496e5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Failed to obtain/create connection from connection pool [DerbyPool]. Reason: Connection creation failed for 1 times.
Error Code: 0. Please see server.log for more details. remote failure: Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 5.0.0-B09.v202507111153-40df9e5d15636cd7801cd5f26058b0963b6496e5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Failed to obtain/create connection from connection pool [DerbyPool]. Reason: Connection creation failed for 1 times.
Error Code: 0. Please see server.log for more details.

Ariho-Seth avatar Aug 02 '25 20:08 Ariho-Seth

#25645 is merged, so the build of the 8.0 branch should work now.

Hello @OndroMih, I updated my local branch too, though this time round the build is failing due to a test in SQLTraceListenerTest class, i.e, public void testSQLQueryWithListener() throws IOException, which expected an asadmin succeeded but an exception was thrown, ie

<remote failure: Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 5.0.0-B09.v202507111153-40df9e5d15636cd7801cd5f26058b0963b6496e5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Failed to obtain/create connection from connection pool [DerbyPool]. Reason: Connection creation failed for 1 times.
Error Code: 0. Please see server.log for more details. remote failure: Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 5.0.0-B09.v202507111153-40df9e5d15636cd7801cd5f26058b0963b6496e5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Failed to obtain/create connection from connection pool [DerbyPool]. Reason: Connection creation failed for 1 times.
Error Code: 0. Please see server.log for more details.

And this looks to be the same with the master branch, too!

Ariho-Seth avatar Aug 02 '25 22:08 Ariho-Seth

Moving this to draft. @Ariho-Seth , please postpone work on this until we're finished with merging this PR: https://github.com/eclipse-ee4j/glassfish/pull/25640 as @dmatej wrote.

OndroMih avatar Aug 03 '25 08:08 OndroMih

Moving this to draft. @Ariho-Seth , please postpone work on this until we're finished with merging this PR: #25640 as @dmatej wrote.

D'accord, yeah, I will be working on other issues then until we are ready.

Ariho-Seth avatar Aug 03 '25 09:08 Ariho-Seth

Hi, @Ariho-Seth, I moved your question about the failing test into a separate dicussion: https://github.com/eclipse-ee4j/glassfish/discussions/25657

OndroMih avatar Aug 04 '25 14:08 OndroMih