Liferay Service Builder not working as expected - liferay-6

I've created a Liferay plugin project which include a JSF+PF based portlet, on which I've created a service.xml file as I aim to create a database table.
The problem is when I try to build the service, by using the Service Builder feature, neither the service layer nor the model layer are created. Actually, and despite of the fact that 'Build Successful' message is displayed in the eclipse console, none of the Service Builder related stuff is created:
WEB-INF/service/*,
/src/db/*,
META-INF/*,
WEB-INF/sql/*,
service.properties.
The log displayed is the following one:
Buildfile: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\build.xml
build-service:
[jar] Building MANIFEST-only jar: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\service-builder-classpath.jar
[delete] Deleting: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\service-builder-classpath.jar.manifest
[delete] Deleting: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\service-builder-classpath.jar
[echo] Loading jar:file:/C:/Liferay/carevid/apache-tomcat-7.0.59/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
[echo] Loading jar:file:/C:/Liferay/carevid/apache-tomcat-7.0.59/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
[echo] Loading file:/C:/Liferay/carevid/apache-tomcat-7.0.59/webapps/ROOT/WEB-INF/classes/portal-ext.properties
[echo] Loading jar:file:/C:/Liferay/carevid/apache-tomcat-7.0.59/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
[echo] 20180315091704988 (El parámetro no es correcto)
[echo] java.lang.NullPointerException
[echo] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.getEntity(ServiceBuilder.java:1012)
[echo] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.getEntity(ServiceBuilder.java:1080)
[echo] at com.liferay.portal.tools.servicebuilder.ServiceBuilder._parseEntity(ServiceBuilder.java:5003)
[echo] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:709)
[echo] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:230)
[mkdir] Created dir: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\docroot\WEB-INF\service-classes
[jar] Building MANIFEST-only jar: C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\docroot\WEB-INF\lib\carevid-entities-portlet-service.jar
[delete] Deleting directory C:\Liferay\carevid\liferay-6.2-ce-ga6\liferay-plugins-sdk-6.2\portlets\carevid-entities-portlet\docroot\WEB-INF\service-classes
BUILD SUCCESSFUL
Although Service Builder related build process finishes successfully (aparently), a java.lang.NullPointerException arises within that build process.
I'd really appreciate whether someone could explain to me what's happening and how I should procced to sort this problem out. Thanks.
(I'm working with liferay-6.2-ce-ga6 version)

You could check twice your service.xml.
That NullPointer seems to be ServiceBuilder that can't find your defined entity and so it can't generate all the classes.
You can have a look to service-builder definition if you need documentation about some tags: liferay-service-builder_6_2_0.dtd

Related

Error occurred during initialization of boot layer java.lang.module.FindException executing Selenium tests using TestNG and Java 12 through Eclipse

ErrorOccuredDuringInitializationofbootlayer I keep getting this error when I run
my test:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for
C:\Users\Bonfire.eclipse\org.eclipse.platform_4.12.0_867647348_win32_win32_x86_64\plugins\com.beust.jcommander_1.72.0.jar
Caused by: java.lang.IllegalArgumentException:
com.beust.jcommander.1.72.0: Invalid module name: '1' is not a Java
identifier
How can I fix it?
Add TestNG Library to classpath in buildpath ( not to module path). It will work fine.
To avoid this error, do not add TestNG library in the project or src folder. Try adding it into the package. To do so , follow the below mentioned procedure.
Right click on the package, click Build Path->Configure Build Path, go to Libraries tab, select Classpath and click on Add Library to select TestNG.
This error message...
Error occurred during initialization of boot layer java.lang.module.FindException:
Unable to derive module descriptor for C:\Users\Bonfire.eclipse\org.eclipse.platform_4.12.0_867647348_win32_win32_x86_64\plugins\com.beust.jcommander_1.72.0.jar
Caused by: java.lang.IllegalArgumentException: com.beust.jcommander.1.72.0: Invalid module name: '1' is not a Java identifier
...implies that there was an issue with the java classpath.
As per the discussion Launch with java 11 fails: Error: Could not find or load main class with Caused by: java.lang.ClassNotFoundException: with there are some issues with some particular classpaths for java-11 and the launch fails if:
The classpath contains a folder with spaces
The classpath length is larger than 32767 characters.
Where as java-8 works fine.
Reference
Unable to import org.openqa.selenium.WebDriver using Selenium and Java 11
Outro
Eclipse plugin: TestNG testcase does not run with Jdk11
Need to add 1.8 version library
Remove TestNG from build path library and add again
Recheck - the issue should be resolved.
I got same issue and I solved it. When creating the project, don't create module-info.java. When the project was already created with the module-info.java, deleting this file didn't help me.
I just created new project without module-info.java, and all works good now.
Best option to resolve this:
Find all file and folder starting with . e.g. — .metadata / .setting and delete them.
Add all the JARS.
Add testNG Libraries.
Execute it.
Done.

Cannot Build and Install Html App using Web Works 2.1 on Device

I'm new in BB Development and I want to test my application on Z3 Device ...
I installed WebWorks 2.1
Then request the bbidtoken.csk file, and I created author.p12 using WebWorks UI.
I enabled Developer Mode on Device.
Also I generated debug token debugtoken.bar using Command line tool.
I deployed debugtoken.bar on my Z3 device.
All files author.p12, barsigner.db, bbidtoken.csk, debugtoken.bar in this path:
"C:\Users\user1\AppData\Local\Research In Motion"
I created Project using WebWorks UI and by default its located in "C:\Users\user1\WebWorks Projects\Project1"
I tried to Build my "Project1" app from WebWorks UI, but this error comes to me:
[INFO] Populating application source
[INFO] Parsing config.xml
[INFO] Generating output files
[INFO] Error: Debug token does not exist or not a file
[INFO] Error: Debug token does not exist or not a file
[ERROR] Native Packager exception occurred
[ERROR] Native Packager exception occurred
An error has occurred
What did I forget to do????!?!
Rename your debugtoken.bar to blackberry10debugtoken.bar and place it inside .cordova folder under %user% and build again. This is one time activity after this you can use BB10 Webworks web interface for direct building and installation of application.Please do not forget to mark it as answer if you got this as your solution :)
I hope it helps!!!

GWT Maven : Module 'xxx' may need to be (re)compiled

Problem: Keep getting "module 'xxx' may need to be (re)compiled".
Steps:
Importing a sample GWT-Maven project into eclipse ("MobileWebApp" - from the GWT SDK).
GWT|compile the project.
Running in production mode (without the codesvr parameter, i.e. using "localhost:8888/MobileWebApp.html").
Notes:
I am fairly new to both GWT and Maven.
I read GWT module may need to be (re)compiled REDUX.
Dev mode does work (I am able to debug the application).
Detailed Steps:
Copying the "MobileWebApp" folder from the "samples" folder inside the GWT SDK (version 2.5.1) to my eclipse workspace.
Importing the project: File->Import->Existing Maven Projects (pointing to the "MobileWebApp" folder where the pom.xml exists.
Configuring the project following these steps: https://developers.google.com/eclipse/docs/faq?hl=iw#gwt_with_maven
At this point I am able to run the app as "Web Application" and debug it.
Running GWT|Compile: The nocache.js stuff is being placed in the target folder.
Now, when i try to run the app in production mode I am getting the (re)compile error.
Logs:
"DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
DataNucleus Enhancer completed with success for 0 classes. Timings : input=713 ms, enhance=0 ms,
total=713 ms. Consult the log for full details
DataNucleus Enhancer completed and no classes were enhanced. Consult the log for full details"
"Compiling module com.google.gwt.sample.mobilewebapp.MobileWebApp
Validating units:
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Compiling 6 permutations
Compiling permutation 0...
Compiling permutation 1...
Compiling permutation 2...
Compiling permutation 3...
Compiling permutation 4...
Compiling permutation 5...
Compile of permutations succeeded
Linking into D:\workspace\eclipse\MobileWebApp\target\MobileWebApp-1.0-SNAPSHOT\mobilewebapp
Invoking Linker AppCacheLinker
Be sure your landing page's tag declares a manifest:
Link succeeded
Compilation succeeded -- 152.077s"
"Initializing App Engine server
06/07/2013 20:12:33 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
06/07/2013 20:12:33 com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed D:\workspace\eclipse\MobileWebApp\target\MobileWebApp-1.0-SNAPSHOT\WEB-INF/appengine-web.xml
06/07/2013 20:12:33 com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed D:\workspace\eclipse\MobileWebApp\target\MobileWebApp-1.0-SNAPSHOT\WEB-INF/web.xml
06/07/2013 20:12:34 com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
06/07/2013 20:12:36 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector#0.0.0.0:8888
06/07/2013 20:12:36 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at localhost:8888/
06/07/2013 20:12:36 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at localhost:8888/_ah/admin
Linking modules
Bootstrap link for command-line module 'com.google.gwt.sample.mobilewebapp.MobileWebApp'
Linking module 'mobilewebapp'
Invoking Linker AppCacheLinker
DevMode warning: Clobbering appcache.nocache.manifest to allow debugging. Recompile before deploying your app!
Be sure your landing page's tag declares a manifest:
06/07/2013 20:13:38 com.google.apphosting.utils.jetty.AppEngineAuthentication$AppEngineAuthenticator authenticate
INFO: Got /MobileWebApp.html but no one was logged in, redirecting."
Pom.xml: https://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/mobilewebapp/
Thanks ahead.
Answering my own question:
1) from command: "mvn gwt:run".
2) Google|GWT compile.
P.S. As much as I am happy figuring that out (after agonizing couple of days) I would still like to know the reasons of why I have to - first lunch the app then compile it. Very strange - in my humble opinion.
offtopic: This sample app was supposed to be "offline executable" (from mobile, at the very least) - so how exactly do I test it? I tried (after running the app once or twice from mobile device, so that it will be cached) to switch to airplane mode and navigating to the app (just like he demonstrated) but, obviously(?), the server is not reachable.. Do I need to enable something specific for it to work? (my mobile device is Google-Nexus-4)
Multiple steps:
Update Project properties -> deployment Assembly using Deploy GWT maven project with eclipse deploys webapp directory instead of target/project directory
mvn clean package
mvn gwt:compile
In eclipse, click on 'GWT Compile Project' -> Advacned -> Remove '-war src/main/webapp' argument and hit compile.
Output should be like this -
Linking into target/project-1.0-SNAPSHOT/ModuleName
Now the deployment should work fine.

Adding gFlot library to a GWT project fails

I downloaded gflot for my gwt project. To get to know the library I created a test project called "FlotDemo". I'm using Eclipse and created a plain vanilla gwt project with the help of the project creation wizard (the stuff with the greeting servlet and so on)
This is what I did:
Downloaded gflot-3.1.1.jar and copied it into /war/WEB-INF/lib
Added in Project->Properties->Java Build Path->Libraries gflot-jar to the path
Added <inherits name="ca.nanometrics.gflot.GFlot"/> to my "FlotDemo.gwt.xml"
Went to gFlot example and copy an pasted it to my EntryPoint class
So after step 4, eclipse strangly cannot resolve the objects from gflot I used in the code. I tried to run the web app anyway in the gwt simulator but it quit with the error message:
2013-06-05 17:24:51.212 java[12069:707] [Java CocoaComponent compatibility mode]: Enabled
2013-06-05 17:24:51.213 java[12069:707] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Loading modules
flotdemo.FlotDemo
Loading inherited module 'flotdemo.FlotDemo'
Loading inherited module 'ca.nanometrics.gflot.GFlot'
[ERROR] Unable to find 'ca/nanometrics/gflot/GFlot.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 11: Unexpected exception while processing element 'inherits'
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:308)
What am I doing wrong here?
<inherits name="ca.nanometrics.gflot.GFlot"/> is the old one.
Since 3.0, use <inherits name='com.googlecode.gflot.GFlot'/> instead.
See the example.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.