This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 230645
Collapse All | Expand All

(-)a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties (+3 lines)
Lines 98-100 Link Here
98
98
99
DNAME_GF_JAVA_EE_IMPL=Java EE from GlassFish
99
DNAME_GF_JAVA_EE_IMPL=Java EE from GlassFish
100
DESC_GF_JAVA_EE_IMPL=Java EE jars that are bundled with the most recently registered GlassFish installation
100
DESC_GF_JAVA_EE_IMPL=Java EE jars that are bundled with the most recently registered GlassFish installation
101
102
Hk2JavaEEPlatformImpl.missingHk2LibraryProvider=Class Hk2LibraryProvider was \
103
not found. Please check for GlassFish Server modules update.
(-)a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformImpl.java (-14 / +71 lines)
Lines 67-72 Link Here
67
import org.netbeans.api.project.Project;
67
import org.netbeans.api.project.Project;
68
import org.netbeans.api.project.ProjectUtils;
68
import org.netbeans.api.project.ProjectUtils;
69
import org.netbeans.api.project.SourceGroup;
69
import org.netbeans.api.project.SourceGroup;
70
import org.netbeans.api.project.libraries.Library;
70
import org.netbeans.modules.glassfish.spi.GlassfishModule;
71
import org.netbeans.modules.glassfish.spi.GlassfishModule;
71
import org.netbeans.modules.glassfish.spi.ServerUtilities;
72
import org.netbeans.modules.glassfish.spi.ServerUtilities;
72
import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider;
73
import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider;
Lines 80-90 Link Here
80
import org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation;
81
import org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation;
81
import org.netbeans.modules.websvc.wsstack.api.WSStack;
82
import org.netbeans.modules.websvc.wsstack.api.WSStack;
82
import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory;
83
import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory;
83
import org.netbeans.api.project.libraries.Library;
84
import org.netbeans.spi.project.libraries.LibraryImplementation;
84
import org.netbeans.spi.project.libraries.LibraryImplementation;
85
import org.openide.DialogDisplayer;
86
import org.openide.NotifyDescriptor;
85
import org.openide.filesystems.*;
87
import org.openide.filesystems.*;
86
import org.openide.util.ImageUtilities;
88
import org.openide.util.ImageUtilities;
87
import org.openide.util.Lookup;
89
import org.openide.util.Lookup;
90
import org.openide.util.NbBundle;
88
import org.openide.util.RequestProcessor;
91
import org.openide.util.RequestProcessor;
89
import org.openide.util.Utilities;
92
import org.openide.util.Utilities;
90
import org.openide.util.lookup.Lookups;
93
import org.openide.util.lookup.Lookups;
Lines 125-136 Link Here
125
    /** Keep local Lookup instance to be returned by getLookup method. */
128
    /** Keep local Lookup instance to be returned by getLookup method. */
126
    private volatile Lookup lkp;
129
    private volatile Lookup lkp;
127
130
128
    /** Jersey Library support. */
129
    private Hk2LibraryProvider libraryProvider;
130
131
    ////////////////////////////////////////////////////////////////////////////
131
    ////////////////////////////////////////////////////////////////////////////
132
    // Static methods                                                         //
132
    // Static methods                                                         //
133
    ////////////////////////////////////////////////////////////////////////////
133
    ////////////////////////////////////////////////////////////////////////////
134
135
    /**
136
     * Display missing Hk2LibraryProvider class warning.
137
     */
138
    private static void missingHk2LibraryProvider() {
139
        String message = NbBundle.getMessage(Hk2JavaEEPlatformImpl.class,
140
                "Hk2JavaEEPlatformImpl.missingHk2LibraryProvider");
141
        NotifyDescriptor notifyDescriptor
142
                = new NotifyDescriptor.Message(message);
143
        DialogDisplayer.getDefault().notify(notifyDescriptor);
144
    }
145
134
    /**
146
    /**
135
     * Map GlassFish tooling SDK JavaSE platforms to NetBeans JavaSE platforms.
147
     * Map GlassFish tooling SDK JavaSE platforms to NetBeans JavaSE platforms.
136
     * <p/>
148
     * <p/>
Lines 300-307 Link Here
300
        this.displayName = displayName;
312
        this.displayName = displayName;
301
        this.libraryName = libraryName;
313
        this.libraryName = libraryName;
302
        this.lookupKey = lookupKey;
314
        this.lookupKey = lookupKey;
303
        this.libraryProvider = Hk2LibraryProvider.getProvider(
304
                dm.getCommonServerSupport().getInstance());
305
        addFcl();
315
        addFcl();
306
        initLibraries();
316
        initLibraries();
307
    }
317
    }
Lines 649-657 Link Here
649
659
650
            @Override
660
            @Override
651
            public void run() {
661
            public void run() {
652
                libraryProvider.setJavaEELibraryImplementation(
662
                try {
653
                        lib, libraryName);
663
                    Hk2LibraryProvider libraryProvider
654
                firePropertyChange(PROP_LIBRARIES, null, libraries.clone());
664
                            = Hk2LibraryProvider.getProvider(
665
                            dm.getCommonServerSupport().getInstance());
666
                    libraryProvider
667
                            .setJavaEELibraryImplementation(lib, libraryName);
668
                    firePropertyChange(PROP_LIBRARIES, null, libraries.clone());
669
                    throw new NoClassDefFoundError();
670
                } catch (NoClassDefFoundError ex) {
671
                    missingHk2LibraryProvider();
672
                }
655
            }
673
            }
656
        });
674
        });
657
    }
675
    }
Lines 812-818 Link Here
812
     * @return GlassFish bundled libraries provider.
830
     * @return GlassFish bundled libraries provider.
813
     */
831
     */
814
    public Hk2LibraryProvider getLibraryProvider() {
832
    public Hk2LibraryProvider getLibraryProvider() {
815
        return libraryProvider;
833
        try {
834
            Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider(
835
                    dm.getCommonServerSupport().getInstance());
836
            return libraryProvider;
837
        } catch (NoClassDefFoundError ex) {
838
            missingHk2LibraryProvider();
839
            return null;
840
        }
816
    }
841
    }
817
842
818
    private class JaxRsStackSupportImpl implements JaxRsStackSupportImplementation {
843
    private class JaxRsStackSupportImpl implements JaxRsStackSupportImplementation {
Lines 825-831 Link Here
825
         */
850
         */
826
        @Override
851
        @Override
827
        public boolean addJsr311Api( Project project ) {
852
        public boolean addJsr311Api( Project project ) {
828
            Library library = libraryProvider.getJaxRsLibrary();
853
            Library library;
854
            try {
855
                Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider(
856
                        dm.getCommonServerSupport().getInstance());
857
                library = libraryProvider.getJaxRsLibrary();
858
            } catch (NoClassDefFoundError ex) {
859
                missingHk2LibraryProvider();
860
                library = null;
861
            }
829
            if ( library!= null ){
862
            if ( library!= null ){
830
                try {
863
                try {
831
                    return ProjectClassPathModifier.addLibraries(
864
                    return ProjectClassPathModifier.addLibraries(
Lines 873-879 Link Here
873
         */
906
         */
874
        @Override
907
        @Override
875
        public boolean extendsJerseyProjectClasspath( Project project ) {
908
        public boolean extendsJerseyProjectClasspath( Project project ) {
876
            Library library = libraryProvider.getJerseyLibrary();
909
            Library library;
910
            try {
911
                Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider(
912
                        dm.getCommonServerSupport().getInstance());
913
                library = libraryProvider.getJerseyLibrary();
914
            } catch (NoClassDefFoundError ex) {
915
                missingHk2LibraryProvider();
916
                library = null;
917
            }
877
            FileObject sourceRoot = getSourceRoot(project);
918
            FileObject sourceRoot = getSourceRoot(project);
878
            if (sourceRoot == null) {
919
            if (sourceRoot == null) {
879
                return false;
920
                return false;
Lines 903-909 Link Here
903
        
944
        
904
        @Override
945
        @Override
905
        public void removeJaxRsLibraries(Project project) {
946
        public void removeJaxRsLibraries(Project project) {
906
            Library library = libraryProvider.getJerseyLibrary();
947
            Library library;
948
            try {
949
                Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider(
950
                        dm.getCommonServerSupport().getInstance());
951
                library = libraryProvider.getJerseyLibrary();
952
            } catch (NoClassDefFoundError ex) {
953
                missingHk2LibraryProvider();
954
                library = null;
955
            }
907
            FileObject sourceRoot = getSourceRoot(project);
956
            FileObject sourceRoot = getSourceRoot(project);
908
            if ( sourceRoot != null){
957
            if ( sourceRoot != null){
909
                String[] classPathTypes = new String[]{ ClassPath.COMPILE , 
958
                String[] classPathTypes = new String[]{ ClassPath.COMPILE , 
Lines 958-964 Link Here
958
         */
1007
         */
959
        @Override
1008
        @Override
960
        public boolean isBundled( String classFqn ) {
1009
        public boolean isBundled( String classFqn ) {
961
            List<URL> urls = libraryProvider.getJerseyClassPathURLs();
1010
            List<URL> urls;
1011
            try {
1012
                Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider(
1013
                        dm.getCommonServerSupport().getInstance());
1014
                urls = libraryProvider.getJerseyClassPathURLs();
1015
            } catch (NoClassDefFoundError ex) {
1016
                missingHk2LibraryProvider();
1017
                urls = Collections.emptyList();
1018
            }
962
            for( URL url : urls ){
1019
            for( URL url : urls ){
963
                FileObject root = URLMapper.findFileObject(url);
1020
                FileObject root = URLMapper.findFileObject(url);
964
                if ( FileUtil.isArchiveFile(root)){
1021
                if ( FileUtil.isArchiveFile(root)){
(-)a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModuleFactory.java (-9 / +39 lines)
Lines 57-70 Link Here
57
import org.glassfish.tools.ide.data.GlassFishServer;
57
import org.glassfish.tools.ide.data.GlassFishServer;
58
import org.netbeans.api.project.libraries.Library;
58
import org.netbeans.api.project.libraries.Library;
59
import org.netbeans.api.project.libraries.LibraryManager;
59
import org.netbeans.api.project.libraries.LibraryManager;
60
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
61
import org.netbeans.modules.glassfish.spi.GlassfishModule;
60
import org.netbeans.modules.glassfish.spi.GlassfishModule;
62
import org.netbeans.modules.glassfish.spi.GlassfishModuleFactory;
61
import org.netbeans.modules.glassfish.spi.GlassfishModuleFactory;
63
import org.netbeans.modules.glassfish.spi.RegisteredDerbyServer;
62
import org.netbeans.modules.glassfish.spi.RegisteredDerbyServer;
64
import org.netbeans.modules.glassfish.spi.ServerUtilities;
63
import org.netbeans.modules.glassfish.spi.ServerUtilities;
65
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException;
64
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException;
65
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
66
import org.netbeans.spi.project.libraries.LibraryTypeProvider;
66
import org.netbeans.spi.project.libraries.LibraryTypeProvider;
67
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
67
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
68
import org.openide.DialogDisplayer;
69
import org.openide.NotifyDescriptor;
68
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
69
import org.openide.modules.InstalledFileLocator;
71
import org.openide.modules.InstalledFileLocator;
70
import org.openide.util.Lookup;
72
import org.openide.util.Lookup;
Lines 79-84 Link Here
79
public class JavaEEServerModuleFactory implements GlassfishModuleFactory {
81
public class JavaEEServerModuleFactory implements GlassfishModuleFactory {
80
82
81
    private static final JavaEEServerModuleFactory singleton = new JavaEEServerModuleFactory();
83
    private static final JavaEEServerModuleFactory singleton = new JavaEEServerModuleFactory();
84
85
    /**
86
     * Display missing Hk2LibraryProvider class warning.
87
     */
88
    private static void missingHk2LibraryProvider() {
89
        String message = NbBundle.getMessage(Hk2JavaEEPlatformImpl.class,
90
                "Hk2JavaEEPlatformImpl.missingHk2LibraryProvider");
91
        NotifyDescriptor notifyDescriptor
92
                = new NotifyDescriptor.Message(message);
93
        DialogDisplayer.getDefault().notify(notifyDescriptor);
94
    }
82
    
95
    
83
    private JavaEEServerModuleFactory() {
96
    private JavaEEServerModuleFactory() {
84
    }
97
    }
Lines 205-213 Link Here
205
                }
218
                }
206
            }
219
            }
207
220
208
            File j2eeDoc = InstalledFileLocator.getDefault().locate(
221
            File j2eeDoc;
222
            try {
223
                j2eeDoc = InstalledFileLocator.getDefault().locate(
209
                    "docs/" + PERSISTENCE_JAVADOC,
224
                    "docs/" + PERSISTENCE_JAVADOC,
210
                    Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
225
                    Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
226
            } catch (NoClassDefFoundError ex) {
227
                missingHk2LibraryProvider();
228
                j2eeDoc = null;
229
            }
211
            if (j2eeDoc != null) {
230
            if (j2eeDoc != null) {
212
                docList.add(ServerUtilities.fileToUrl(j2eeDoc));
231
                docList.add(ServerUtilities.fileToUrl(j2eeDoc));
213
            } else {
232
            } else {
Lines 271-277 Link Here
271
290
272
    private static boolean ensureGlassFishApiSupport(GlassFishServer server) {
291
    private static boolean ensureGlassFishApiSupport(GlassFishServer server) {
273
        String installRoot = server.getServerRoot();
292
        String installRoot = server.getServerRoot();
274
        List<URL> libraryList = Hk2LibraryProvider.getProvider(server).getJavaEEClassPathURLs();
293
        List<URL> libraryList;
294
        try {
295
            libraryList = Hk2LibraryProvider.getProvider(server).getJavaEEClassPathURLs();
296
        } catch (NoClassDefFoundError ex) {
297
            missingHk2LibraryProvider();
298
            libraryList = null;
299
        }
275
        List<URL> docList = new ArrayList<URL>();
300
        List<URL> docList = new ArrayList<URL>();
276
        String name = JAVA_EE_5_LIB;
301
        String name = JAVA_EE_5_LIB;
277
302
Lines 279-288 Link Here
279
        if (f != null && f.exists()) {
304
        if (f != null && f.exists()) {
280
            name = JAVA_EE_6_LIB;
305
            name = JAVA_EE_6_LIB;
281
        }
306
        }
282
307
        File j2eeDoc;
283
        File j2eeDoc = InstalledFileLocator.getDefault().locate(
308
        try {
284
                "docs/" + JAVA_EE_JAVADOC,
309
            j2eeDoc = InstalledFileLocator.getDefault().locate(
285
                Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
310
                    "docs/" + JAVA_EE_JAVADOC,
311
                    Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
312
        } catch (NoClassDefFoundError ex) {
313
            missingHk2LibraryProvider();
314
            j2eeDoc = null;
315
        }
286
        if (j2eeDoc != null) {
316
        if (j2eeDoc != null) {
287
            try {
317
            try {
288
                docList.add(ServerUtilities.fileToUrl(j2eeDoc));
318
                docList.add(ServerUtilities.fileToUrl(j2eeDoc));
Lines 295-301 Link Here
295
325
296
        // additional jar for glassfish-samples support
326
        // additional jar for glassfish-samples support
297
        f = ServerUtilities.getJarName(installRoot, "web-core" + ServerUtilities.GFV3_VERSION_MATCHER);
327
        f = ServerUtilities.getJarName(installRoot, "web-core" + ServerUtilities.GFV3_VERSION_MATCHER);
298
        if (f != null && f.exists()) {
328
        if (f != null && f.exists() && libraryList != null) {
299
            try {
329
            try {
300
                libraryList.add(ServerUtilities.fileToUrl(f));
330
                libraryList.add(ServerUtilities.fileToUrl(f));
301
            } catch (MalformedURLException ex) {
331
            } catch (MalformedURLException ex) {
Lines 309-315 Link Here
309
        String[] JERSEY_LIBS = (isGFV31 ? JAXRS_LIBRARIES_31 : JAXRS_LIBRARIES);
339
        String[] JERSEY_LIBS = (isGFV31 ? JAXRS_LIBRARIES_31 : JAXRS_LIBRARIES);
310
        for (String entry : JERSEY_LIBS) {
340
        for (String entry : JERSEY_LIBS) {
311
            f = ServerUtilities.getJarName(installRoot, entry + ServerUtilities.GFV3_VERSION_MATCHER);
341
            f = ServerUtilities.getJarName(installRoot, entry + ServerUtilities.GFV3_VERSION_MATCHER);
312
            if ((f != null) && (f.exists())) {
342
            if ((f != null) && (f.exists()) && libraryList != null) {
313
                try {
343
                try {
314
                    libraryList.add(
344
                    libraryList.add(
315
                            FileUtil.getArchiveRoot(Utilities.toURI(f).toURL()));
345
                            FileUtil.getArchiveRoot(Utilities.toURI(f).toURL()));

Return to bug 230645