running "mvn appfuse:gen" does nothing - java

I'm Using Oracle db alongside the Appfuse ,but it does nothing when using command above (mvn appfuse:gen).for example, it's expected to generate a PersonDao/PersonDaoHibernate class in the dao folder if we use the command . but nothing's happened. Meanwhile, I'v visited the following Pages:
http://static.appfuse.org/plugins/appfuse-maven-plugin/gen-model-mojo.html
http://static.appfuse.org/plugins/appfuse-maven-plugin
but couldn't reconstruct it's content in practice. Does anybody can show a tutorial that basically explain the details ,please (Say, from generating the pojos .. to jsp files)?

Once you have a JavaBean (POJO class), you could generate all layers with following command:
mvn appfuse:gen -Dentity=Name
where 'Name' has to be replaced with Name of your JavaBean (Entity). Alternatively, you can use:
mvn appfuse:gen -Damp.genericCore=false -Dentity=Name
if you don't want to use GenericDao and GenericManager.
For further investigation I suggest:
http://appfuse.org/display/APF/AppFuse+Maven+Plugin#AppFuseMavenPlugin-amp-crud

Related

spring boot 3 native fail with javaAgent configured

I must say that I am pretty new with graalvm (like most people nowadays).
I have been following this guide created by #joshLong to create a spring boot native application.
In the guide it explains that we can use the java agent while executing tests in order to create the reflect-config.json and other files that are "given as an input to the graalVm compiler". This is also explained in the spring boot documentation here and also here
I created a repo (Which is a clone of the one from the guide), and just made one commit in order to "activate the java agent while executing the test" (in the history of the branch just look at the last commit).
please get it like this:
git clone https://github.com/clembo590/issues.git --branch issue_with_agent
when executing: mvn clean -P native native:compile I get this error
Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.String com.example.aot.properties.DemoProperties.name()
I looked on the web if I could find something about this issue:
I found one issue on github about that , but I do not know how to fix it in the case of a spring boot app.
Thank you for your help.

How to make IntelliJ show the real names for method parameters?

How to I setup the IDEA IDE, so that it shows real param names for methods in build-in classes?
mvn clean install dependency:sources did not help me
upd:
HttpExchange from package
import com.sun.net.httpserver.HttpExchange
The library you want to use does not have debug information included in the bytecode which is (for now) needed for this to work. Source is not enough.
If you cannot locate a debug build you may have to compile it yourself. If you cannot access the source, you may need to ask the vendor politely.

I keep getting "error package com.mongodb does not exist" when trying to compile MongoDB Utilites class

I am running a webapp using a connection to MongoDB where products reviews are stored. The current version of the webapp works correctly. (i.e. it writes and stores new reviews in the MongoDB collection).
Nonetheless, when I make changes and try to compile a new version of the MongoDB Utilities class I keep getting:
error package com.mongodb.XXX does not exist
import com.mongodb.BasicDBObject;
^
I do have the following .jar files in the \lib directory:
mongodb-driver-3.6.3
mongodb-driver-core-3.6.3
mongodb-java-driver-3.6.3
bson-3.6.3
and I mentioned them in the CLASSPATH variable:
set CLASSPATH=.;C:\apache-tomcat-7.0.34\lib\servlet-api.jar;C:\apache-tomcat-7.0.34\lib\jsp-api.jar;C:\apache-tomcat-7.0.34\lib\el-api.jar;C:\apache-tomcat-7.0.34\lib\commons-beanutils-1.8.3.jar; C:\apache-tomcat-7.0.34\lib\mongo-java-driver-3.6.3.jar; C:\apache-tomcat-7.0.34\lib\bson-3.6.3;C:\apache-tomcat-7.0.34\lib\mongodb-driver-3.6.3; C:\apache-tomcat-7.0.34\lib\mongodb-driver-core-3.6.3; C:\apache-tomcat-7.0.34\lib\mysql-connector-java-5.1.38-bin.jar;
What am I doing wrong? How can I get java to compile my new MongoDB Utilities class?
I couldn't reproduce the same behaviour, but I only reference mongodb-java-driver-3.6.3 in my build scripts.
Since the mongodb-java-driver is an uber JAR that contains mongodb-driver, mongodb-driver-core, and bson, you could try removing these latter three from your classpath and build scripts and see if that resolves the issue.
I was able to solve my issue so I post this answer in case someone is stuck in the same problem.
Thanks to what user "nos" posts in the answer to this question I used the -verbose option when compiling e.g.:
javac -verbose className.java
In the errors log I noticed that the Java compiler was searching for the MongoDB classes in a different \lib folder than the one I used in my CLASSPATH definition. So I added a copy of the mongodb-java-driver there and the compilation worked.
As craigcaulfield correctly mentions above there is no need to add the other drivers ( mongodb-driver, mongodb-driver-core, and bson).

How to execute JUnitTests in Runtime-Workspace (JUnit-Plugin-Test)?

I'm facing a problem with JUnit tests. I have written an JUnitRunner which is used to execute the WrapperTest.
The WrapperTest generates a plain JUnit-Test and a needed file. If I want to execute the methods of the generated test, my Runner searchs in the Developement-Workspace for the "NeededClass".
I'm generating the needed class in the JUnit-Workspace and i want the tests to use this generated class file, so i can delete this file in my Develop-Workspace.
So, how do I execute the generated test in the JUnit-Workspace? (He shall look in the JUnit-Workspace for the needed file)
edit: OK, i found out, it's a ClassLoader problem... The Develop Workspace got another ClassLoader than the JUnit-Workspace, this causes weired errors, for example that a "class isn't the identical class Exception" (java.lang.ClassCastException: org.junit.runner.JUnitCore cannot be cast to org.junit.runner.JUnitCore). Looks like i have to fix this problem by reflection, what is very dirty.
Look into Maven and its build lifecycle. You can wire the code generation you are doing into the generate-test-sources phase and then have it participate as normal in the test phase.
See this question for an example.

GWT Maven Plugin -- gwt:run works but gwt:compile doesn't. Why?

I'm using gwt-maven-plugin to manage a GWT project. I use the gwt:run goal all the time to run locally in "dev mode" for testing. I now want to compile my project into a war for deployment on Tomcat. When I run gwt:compile, however, I get compile errors that indicate a classpath configuration issue. An example:
Finding entry point classes
[ERROR] Errors in 'shared.MyClass.java'
[ERROR] Line 4: The import server.model.MyObject cannot be resolved
Any ideas? Do I need to manually add the server package to some config file somewhere? Thanks in advance for any info.
-tjw
Ok, I found the problem. I found this in the GWT forums by Thomas Broyer (a GWT dev):
I mean you have to "javac" classes that are referenced from
annotations (in this case, the PlaceTokenizer classes referenced from
#WithTokenizers; that'd be true also of your service, domain object,
locator or service locator with RequestFactory, unless you use
#ServiceName and #ProxyForName). Otherwise, GWT can work with only
the *.java files, without the *.class.
I am trying to load in these classes from annotations since they are used with RequestFactory. My question is now this: How is this restriction not completely insane?

Categories