[Beginner's Corner] - Getting Up & Running with MySQL, DataNucleus & JDO
by El Noobie
El Noobie [https://community.jboss.org/people/elnoobie] created the discussion
"Getting Up & Running with MySQL, DataNucleus & JDO"
To view the discussion, visit: https://community.jboss.org/message/831210#831210
--------------------------------------------------------------
*Warning*: I am a complete newbie with JBoss AS7.
*The Goal & Tools*
My primary goal is to get a complete service up and running locally (at first). Later I will worry about moving things to OpenShift and playing around with that. The key tool for all of this is just going to be use of Maven 3.x in order to get things built & deployed locally. Therefore I'd like to stick with the standard Maven conventions for everything.*
*
*Where I Am Sucessful*
1. Able to get the core of everything working with JSF, some REST & SOAP WS, XML/JSON setup, etc.
2. Able to get a bunch of OSGi stuff running
3. Figured out a bunch of logging issues so I can get Logback with SLF4J running
4. No issues deploying/undeploying anything via Maven
5. Using Liquibase for the basic database setup which was really easy
6. All is good with getting MySQL up, recognized and tested via the web console1. Added MySQL as a module
2. Added DataNucleus as a module
3. Defiend 2 data sources: 1 with JPA, 1 without
I was able to follow the basics with the help of a couple web articles:
* https://community.jboss.org/docs/DOC-17094?_sscc=t https://community.jboss.org/wiki/GettingStartedWithJDOOnJbossAS7InSevenSt...
* http://hwellmann.blogspot.com/2011/10/jboss-as-7-catching-up-with-java-ee... http://hwellmann.blogspot.com/2011/10/jboss-as-7-catching-up-with-java-ee...
*Where I Am Stuck*
So now I am starting to get to the recognition of the data source(s) within JBoss and hoping to move quickly onto the DataNucleus and JDO end of things. However, I cannot get the data source reference via a context lookup without getting a "+Name Not Found+" exception. I really want to get this piece-by-piece to understand the inner workings and therefore I don't want to skip this step before moving on to the setup of +persistence.xml+ and whatnot.
My data sources are setup like this in +standalone.xml+:
<datasource jta="false" jndi-name="java:/datasources/testMeDS" pool-name="testMeDS-pool" enabled="true" use-java-context="true" use-ccm="true">
...
</datasource>
<datasource jta="true" jndi-name="java:/datasources/testMeDS-JTA" pool-name="testMeDS-JTA-pool" enabled="true" use-java-context="true" use-ccm="true">
...
</datasource>
In my simple, little JAX-RS setup I created a +DataSourceService+ class that looks like this:
@Path ("/dstest")
public class DataSourceService {
@Context
HttpServletRequest request;
@GET
@Produces({MediaType.APPLICATION_XML})
public DSTestDocument getDataSourceTestResults() {
try {
// Obtain our environment naming context
InitialContext initCtx = new InitialContext();
javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
// Look up our data source
Object lol = envCtx.lookup("java:/datasources/testMeDS");
} catch (Exception e) {
e.printStackTrace(System.err);
}
// build the document
// ...
// do some logging
// ...
return theResopnseDocumentObject;
}
}
I get the following exception:
> [stderr] (http--0.0.0.0-8080-1) javax.naming.NameNotFoundException: jboss/datasources/testMeDS -- service jboss.naming.context.java.module.ElTesting."webservices-1.0-SNAPSHOT".jboss.datasources.testMeDS
> at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
> at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
> at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
>
Can someone help me out so I can move on to the next steps?
I know that I won't follow https://community.jboss.org/docs/DOC-17094?_sscc=t steps 5 and 6 from the one article listed above exactly - and I will tackle that mountain when I get to it. I know I'll need to setup the +persistence.xml+ and other things but I am not even going to bother to try until I get this part resolved. I want to make sure I can connect to the data source and do some things manually before that. That gives me an opportunity to play with more CDI and various other things utilizing JBoss to get a better understanding of the options opened and internal workings.
Thanks in advance!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/831210#831210]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 8 months
[JBoss Tools] - OpenShift push does not work in 4.1
by david meier
david meier [https://community.jboss.org/people/membersound] created the discussion
"OpenShift push does not work in 4.1"
To view the discussion, visit: https://community.jboss.org/message/831098#831098
--------------------------------------------------------------
Hi,
I tried pushing a war file using latest Jboss Tools 4.1 and Kepler. But the publishing does not work.
I discussed this already on the OpenShift forums https://www.openshift.com/forums/openshift/cannot-publish-a-tomcat-app-to... https://www.openshift.com/forums/openshift/cannot-publish-a-tomcat-app-to..., to ensure my ROOT.WAR does acutally work on their servers.
As it is really simple to use Jboss Tools to deploy in openshift, I think there must be something in the plugin background that causes the failure.
Pushing to a Tomcat OpenShift gives an error that pom.xml cannot be found, even though it IS located in the root of my project. And, as I wrote, the project war works.
Publishing to a Tomcat 7 openshift deployment fails with:
Skipping Maven build due to absence of pom.xml + tmp=/var/lib/openshift/51f9754550044663ea0000d7/jbossews//tmp + '[' -d /var/lib/openshift/51f9754550044663ea0000d7/jbossews//tmp ']' + for d in '$tmp/' + '[' -d '/var/lib/openshift/51f9754550044663ea0000d7/jbossews//tmp/' ']' + '[' -d /var/lib/openshift/51f9754550044663ea0000d7/app-root/runtime/repo//webapps ']' + rm -rf /var/lib/openshift/51f9754550044663ea0000d7/jbossews//webapps/ROOT.war Timed out waiting for http listening port An error occurred executing 'gear postreceive' (exit code: 1) Error message: Failed to execute: 'control start' for /var/lib/openshift/51f9754550044663ea0000d7/jbossews
For more details about the problem, try running the command again with the '--trace' option.
Your server logs show the following:
SEVERE: Parse Fatal Error at line 1 column 1: Premature end of file. org.xml.sax.SAXParseException; systemId: file:/var/lib/openshift/51f9754550044663ea0000d7/jbossews/conf/server.xml; lineNumber: 1; columnNumber: 1; Premature end of file. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1404) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1034) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537) at org.apache.catalina.startup.Catalina.load(Catalina.java:610) at org.apache.catalina.startup.Catalina.start(Catalina.java:672) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456) Jul 31, 2013 4:37:55 PM org.apache.catalina.startup.Catalina load WARNING: Catalina.start using conf/server.xml: Premature end of file. Jul 31, 2013 4:37:55 PM org.apache.catalina.startup.Catalina start SEVERE: Cannot start server. Server instance is not configured.
==> jbossews/logs/jbossews.log <== sed: can't read /var/lib/openshift/51f9754550044663ea0000d7/app-root/runtime/repo//.openshift/config/server.xml: No such file or directory sed: can't read /var/lib/openshift/51f9754550044663ea0000d7/app-root/runtime/repo//.openshift/config/context.xml: No such file or directory
==> jbossews/logs/host-manager.2013-07-31.log <==
==> jbossews/logs/catalina.2013-07-31.log <== Jul 31, 2013 4:36:46 PM org.apache.catalina.startup.Catalina addClusterRuleSet INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled. Jul 31, 2013 4:36:46 PM org.apache.catalina.startup.Catalina addClusterRuleSet INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled. Jul 31, 2013 4:36:46 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/i386:/lib:/usr/lib Jul 31, 2013 4:36:47 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-127.6.132.1-8080"] Jul 31, 2013 4:36:47 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1878 ms Jul 31, 2013 4:36:48 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jul 31, 2013 4:36:48 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.40 Jul 31, 2013 4:36:48 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /var/lib/openshift/51f9754550044663ea0000d7/jbossews/webapps/ROOT.war Jul 31, 2013 4:36:56 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [734] milliseconds. Jul 31, 2013 4:36:57 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-127.6.132.1-8080"] Jul 31, 2013 4:36:57 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 9276 ms
Could you try my WAR file ( https://docs.google.com/file/d/0B0qVi9D7R5MZQ25leEpEd1BVck0/edit?usp=sharing https://docs.google.com/file/d/0B0qVi9D7R5MZQ25leEpEd1BVck0/edit?usp=sharing) (16mb vaadin test project) and confirm that Jboss Tools does not work here? Or if you couldn't, please provide your steps that worked for you.
Thanks
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDetect languageDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddish⇄AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddishSprache erkennen » Hungarian
HI,
AsA
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/831098#831098]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 8 months