I forgot to mention this, but if you're up to it convert to using Maven projects. Netbean's maven integration is the best I've ever seen for any IDE. And when you relieve your project from netbean's horrible ant projects all your NB related problems are history and you are in total control of your projects. Netbeans doesn't create any metadata in Maven projects. They are pure maven, which means you can also take any maven project and simply open it in Netbeans. I for instance have the OpenEJB subversion trunk's parent POM opened in netbeans, and when I want to browse it's source I only have to expand it and select which module I want to open.
To do so is very easy, and you need no prior maven knowledge, except understand the concept of dependencies which work by repository/identity and not by JAR archive. You don't even need a Maven installation as netbeans has a built in Maven 3.0-SNAPSHOT. Though it is recommended to point it to a locally installed one. From here all you have to do is New Project->Maven->Maven Module, and select EJB, WAR, EAR, or whatever archetype you want. Then the rest is pretty much the same. The sources/tests/resources folders still look/work like any other Netbeans project. Like I mentioned, the only difference is when you add dependencies. You have to right-click on the Libraries node and select Add Dependency. Then search for a dependency by name, select it and you're done. It will be automatically downloaded. The repositories included in Netbeans have so far contain anything I've wanted to add. I'm only saying this as it made my life much easier. I've since become a maven "fan", and would recommend it to anyone who wants a general, widely supported project management system, standardized layouts, great unit testing support and a wide range of plugins to make your software development life much easier. Also, since OpenEJB is also done in Maven (as mentioned above), you can manage your OpenEJB versions much easier. You only need to update the version you want to use in the Libraries node and rebuild the project - which is done by selecting it from a list of available versions. You're set. Everything else will be done for you. Quintin Beukes On Thu, Oct 8, 2009 at 7:10 PM, Quintin Beukes <[email protected]> wrote: > With netbeans it's not an easy task. > > It comes from the server you selected. The best option is to select a > Geronimo server, though the Geronimo plugin for netbeans is only > available in 6.8, and only supports an older version of geronimo 2.0 > or something - it technically supports them all, but doesn't recognize > newer installations as it looks for the geronimo-kernel jar with a > specific version. I got around this by modifying it's source and > changing the file it looks for to the one in my geronimo installation > and all it's features worked from here. Though it's very limited and > can only deploy WAR archives, it does help with the classpath > problems. > > The best practice option for this is to define the property in your > project's run options. When you go into the project's properties and > to the Run page where you select the server, you'll see a text field > at the bottom that allows you to enter options. Define the property > there, something like: -Dj2ee.platform.SOMETHING.classpath= > > An alternative is to select a null server (open your project's > configuration files and remove/empty the server selection). > > And another alternative (which I don't recommend you do unless you > don't need the other servers ever again) is to edit netbeans' internal > representation of the glassfish servers and modify their classpaths. > > Try the first option first, if it doesn't work reply to this e-mail. I > was successful in using that technique, so if it doesn't work for you > we only missed something. > > Quintin Beukes > > > > On Thu, Oct 8, 2009 at 4:25 PM, happy_go_lucky_mate > <[email protected]> wrote: >> >> Hi Quintin, >> >> You are right. Looks like the jar from the glassfish libs is the responsible >> culprit. Now that you mention it, I am not even sure why its showing up in >> the first place at all. Its definitely not in the project library and I do >> not reference it anywhere in the code either. The only place I see a >> reference for it is in the netbeans 'private.properties' files as part of >> the j2ee.platform.*.classpath entries. >> >> Thanks for all the help. Hopefully once I get rid of that jar I shouldn't be >> having any more problems. In the meanwhile, if you know any tips on getting >> rid of it, please feel free to let me know :) >> >> SG Peter >> >> >> Quintin Beukes-2 wrote: >>> >>> Hey, >>> >>> Is there any reason you have the glassfish libs on your classpath. >>> Some of these libs do cause problems with OpenEJB. I can't recall >>> exactly which ones, but I myself has spent many minutes filtering the >>> culprits out. In the end you don't even need the glassfish libs on >>> your classpath at all. OpenEJB covers the JavaEE spec, so you don't >>> need them. When you deploy to glassfish they'll be there anyway. >>> >>> If you decide to keep them on your classpath, here is an unrelated >>> tip. Depending on the netbeans version, some of them leave the >>> "package" option for the server libraries checked, which means the >>> glassfish libs are packaged inside the EJB. You might want to uncheck >>> this - will make your ejb much smaller and build faster. I haven't >>> noticed that happening with the more recent netbeans versions though. >>> >>> I'm not sure if this is your problem, but with those >>> application-client.xml messages, and the Glassfish webservers jars on >>> the classpath, it might just be the cause. >>> >>> Quintin Beukes >>> >>> >>> >>> On Wed, Oct 7, 2009 at 11:25 PM, Sibin Peter <[email protected]> >>> wrote: >>>> Hi there, >>>> >>>> I just installed openEJB v3.1.1 in order to unit test the ejbs I am >>>> creating >>>> in my webapp as part of a TDD approach that I am trying to incorporate. >>>> Anyways, I am currently getting the following errors and cannot seem to >>>> resolve them. >>>> >>>> ################################################################################################################################################################ >>>> >>>> Apache OpenEJB 3.1.1 build: 20090530-06:18 >>>> http://openejb.apache.org/ >>>> INFO - openejb.home = C:\__Working\Netbeans Projects\MyApp\MyApp-ejb >>>> INFO - openejb.base = C:\__Working\Netbeans Projects\MyApp\MyApp-ejb >>>> INFO - Configuring Service(id=Default Security Service, >>>> type=SecurityService, provider-id=Default Security Service) >>>> INFO - Configuring Service(id=Default Transaction Manager, >>>> type=TransactionManager, provider-id=Default Transaction Manager) >>>> INFO - Found EjbModule in classpath: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\build\test\classes >>>> INFO - Found ClientModule in classpath: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\hibernate-persistence\javassist.jar >>>> INFO - Found ClientModule in classpath: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\JasperReports3.5.2\iText-2.1.0.jar >>>> INFO - Found ClientModule in classpath: C:\Program Files\NetBeans >>>> 6.7.1\java2\ant\lib\ant.jar >>>> INFO - Found ClientModule in classpath: C:\Program Files\NetBeans >>>> 6.7.1\java2\ant\lib\ant-launcher.jar >>>> INFO - Found ClientModule in classpath: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\OpenEJB\xml-resolver-1.2.jar >>>> INFO - Found EjbModule in classpath: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\build\jar >>>> INFO - Found ClientModule in classpath: >>>> C:\Users\me\Documents\Downloads\glassfish\lib\webservices-tools.jar >>>> INFO - Beginning load: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\build\test\classes >>>> INFO - Beginning load: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\hibernate-persistence\javassist.jar >>>> INFO - Beginning load: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\JasperReports3.5.2\iText-2.1.0.jar >>>> INFO - Beginning load: C:\Program Files\NetBeans >>>> 6.7.1\java2\ant\lib\ant.jar >>>> INFO - Beginning load: C:\Program Files\NetBeans >>>> 6.7.1\java2\ant\lib\ant-launcher.jar >>>> INFO - Beginning load: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\lib\OpenEJB\xml-resolver-1.2.jar >>>> INFO - Beginning load: C:\__Working\Netbeans >>>> Projects\MyApp\MyApp-ejb\build\jar >>>> INFO - Beginning load: >>>> C:\Users\me\Documents\Downloads\glassfish\lib\webservices-tools.jar >>>> INFO - Configuring enterprise application: classpath.ear >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: javassist.jar >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: iText-2.1.0.jar >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: ant.jar >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: ant-launcher.jar >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: xml-resolver-1.2.jar >>>> WARN - No application-client.xml found assuming annotations present: >>>> classpath.ear, module: webservices-tools.jar >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/CodeWriter.class >>>> at org.apache.xbean.finder.ClassFinder.readClassDef(ClassFinder.java:730) >>>> at >>>> org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:141) >>>> at >>>> org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:113) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:313) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:257) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:184) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:247) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:601) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:551) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:380) >>>> at >>>> org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:292) >>>> at >>>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:271) >>>> at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:137) >>>> at org.apache.openejb.OpenEJB.init(OpenEJB.java:286) >>>> at org.apache.openejb.OpenEJB.init(OpenEJB.java:265) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>> at >>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>>> at >>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>> at >>>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36) >>>> at >>>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71) >>>> at >>>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53) >>>> at >>>> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42) >>>> at >>>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) >>>> at >>>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) >>>> at javax.naming.InitialContext.init(InitialContext.java:223) >>>> at javax.naming.InitialContext.<init>(InitialContext.java:197) >>>> at >>>> us.tx.state.tdcj.ocrt.service.updater.OffenderLocationUpdateSessionBeanTest.setUp(OffenderLocationUpdateSessionBeanTest.java:53) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>> at >>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>>> at >>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>> at >>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) >>>> at >>>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) >>>> at >>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) >>>> at >>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) >>>> at >>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) >>>> at >>>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) >>>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) >>>> at >>>> org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) >>>> at >>>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) >>>> at >>>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) >>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:220) >>>> at >>>> junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39) >>>> at >>>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515) >>>> at >>>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031) >>>> at >>>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888) >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JAnonymousClass.class >>>> at >>>> org.apache.xbean.finder.ClassFinder.readClassDef(ClassFinder.java:730) >>>> at >>>> org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:141) >>>> at >>>> org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:113) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:313) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:257) >>>> at >>>> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:184) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:247) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:601) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:551) >>>> at >>>> org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:380) >>>> at >>>> org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:292) >>>> at >>>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:271) >>>> at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:137) >>>> ...... >>>> java.lang.Exception: Could not load 1/0/com/sun/codemodel/JArray.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JArrayClass$1.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JArrayClass.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JArrayCompRef.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JAssignment.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/codemodel/JAssignmentTarget.class >>>> ........ >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/relaxng/javadt/AbstractDypeImpl.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/relaxng/javadt/DypeLibraryImpl.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/relaxng/javadt/JavaIdentifierDype.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/relaxng/javadt/JavaPackageDype.class >>>> java.lang.Exception: Could not load 1/0/com/sun/relaxng/javadt/Name.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/tools/xjc/AbortException.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/tools/xjc/BadCommandLineException.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/tools/xjc/CodeAugmenter.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/tools/xjc/ConsoleErrorReporter.class >>>> ......... >>>> java.lang.Exception: Could not load 1/0/com/sun/xml/xsom/XSAnnotion.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XStContainer.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XStGroupDecl.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XStributeDecl.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XStributeUse.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XSComplexType.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XSComponent.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XSContentType.class >>>> java.lang.Exception: Could not load >>>> 1/0/com/sun/xml/xsom/XSDeclarion.class >>>> ........ >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/Calog.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/CalogEntry.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/CalogException.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/CalogManager.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/Resolver.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/Version.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/apps/XParseError.class >>>> java.lang.Exception: Could not load >>>> 1/0/org/apache/xml/resolver/apps/resolver.class >>>> .......... >>>> >>>> ###################################################################################################################################################################### >>>> >>>> and so on for a bunch of classes. >>>> >>>> I looked at the 1/0/com/sun/codemodel/*.class files and noticed that they >>>> are supposed to be in the jaxb-xjc-2.1.8.jar. So I went ahead and added >>>> that >>>> to the OpenEJB library, but that did not resolve the isse. Can you tell >>>> me >>>> what I need to do to get rid of these Exception messages? >>>> >>>> Thanks for the help in advance !!! >>>> >>>> >>>> Best Regards >>>> SG Peter >>>> >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Getting-a-bunch-of-java.lang.Exception%3A-Could-not-load-*.class--errors.-tp25794756p25803093.html >> Sent from the OpenEJB User mailing list archive at Nabble.com. >> >> >
