I'm trying to customize the Liferay Web Forms portlet to accept a file control, and I've just about gotten everything working except for the UploadPortletRequest to handle the actual uploading of the file from the form!
I've got:
import com.liferay.portal.upload.UploadPortletRequestImpl;
and in the compiler output:
[javac] 1. ERROR in C:\Program Files\Liferay Developer Studio\liferay-plugins-sdk-6.0-ee-sp2-20110727\portlets\AZ_WebForms-portlet\docroot\WEB-INF\src\com\liferay\autozone\webform\portlet\AZ_WebForm.java (at line 34)
[javac] import com.liferay.portal.upload.UploadPortletRequestImpl;
[javac] ^^^^^^^^^^^^^^^^^^^^^^^^^
[javac] The import com.liferay.portal.upload cannot be resolved
BUT...If I add portal-impl.jar to the Portal Dependency JARs to be able to resolve the class, it won't compile because portal-impl.jar is in WEB-INF/lib!! (and it doesn't like that)
I'm kind of at a loss here. What do I need to do?
You can't use anything from portal-impl.jar, unless you use ext environment and you modify Liferay.
From your compiler output I would say that you are writing your own portlet, not customizing existing. Am I wrong?
You must handle upload your self. Yyou can use Apache commons fileupload, it supports portlets.
Pleas see Using FileUpload, specifically Servlets and portlets part
Related
I have just recently started using Eclipse and am running into problems trying to install external libraries. Following online tutorials, I add the .jar file to the classpath and I see it in the referenced libraries folder. Despite this, when trying to import, I get the error:
The package org.apache.commons is not accessible
For reference, I am trying to install the apache math commons library.
Your code probably has two issues.
First, the import statement is wrong since in Java you cannot add a package itself, but all classes of a package as follows (note .*; at the end):
import org.apache.commons.math4.linear.*;
or a specific class, e.g.
import org.apache.commons.math4.linear.FieldMatrix;
Second, you use the Java Platform Module System (JPMS) by having a module-info.java file in the default package probably without the required requires <module>; statement. JPMS was introduced in Java 9 and you have Java 12.
Do one of the following:
Delete the module-info.java file (if needed, you can recreate it via right-clicking the project folder and choosing Configure > Create module-info.java)
In module-info.java add the corresponding requires statement, e.g. by going to the line with the import statement and using the corresponding Quick Fix (Ctrl+1)
I was following mirth tutorials link : http://www.mirthcorp.com/community/wiki/display/mirth/Creating+a+custom+Web+Service+in+Mirth+Connect+3.0.1
My current mirth version is 3.5.x . Even downloaded donkey-server.jar and donkey-client.jar from mirth library. But when I import it I dont see the AcceptMessage and WebServiceReceiver class being resolved. When I verified in the jars the path com.mirth.connect.connectors.ws is not present.
Please let me which jar to be used to resolve this issue?
Those classes are in extensions/ws/ws-server.jar. You can add that to the classpath (with -cp) when compiling your code. More information here: http://www.mirthcorp.com/community/wiki/display/mirth/How+to+create+and+invoke+custom+Java+code+in+Mirth+Connect
I am quiet familiar with protobuf 2.5. I was trying to use protobuf3.0. It seems that the jar is to be generated form the source code available online. But when i import the source code into eclipse and try to create a jar, i can see many errors in the following files
/protobuf3/src/com/google/protobuf/Descriptors.java,
/protobuf3/src/com/google/protobuf/DynamicMessage.java
/protobuf3/src/com/google/protobuf/ExtensionRegistry.java
/protobuf3/src/com/google/protobuf/MessageReflection.java
/protobuf3/src/com/google/protobuf/TextFormat.java
/protobuf3/src/com/google/protobuf/UnsafeUtil.java
This is one of the errors "the import com.google.protobuf.DescriptorProtos cannot be resolved".
Is this the right way to generate the jar (or) is it available anywhere (or) is the full source code available anywhere.
Any help would be appreciated.
Thanks.
This is where i downloaded the source code protobuf3.0-source code
You can find a compiled (JAR) version of Protobuf to download here:
http://search.maven.org/remotecontent?filepath=com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar
I recommend you look at a build manager such as https://maven.apache.org/ to automatically handle fetching dependencies (libraries) for you.
I am importing a Jar file "com.ibm.mq.jar" into my workspace(Eclipse IDE).
While importing, a screen came where I could see all the classes in the Jar file.
After I imported it into the work space, I was able to import the package and following statement didn't give any error.
import com.ibm.mq.*;
But, in code I am not able to use any of the classes which were there in the package.
Like, "MQC" is a class in the package, but in code it doesn't reflect("MQC cannot be resolved as a type" error comes if I try to use it).
This jar file actually contains Websphere MQ API classes.
Can anyone advise, what am I missing.
If you're using MQ 7, check its documentation here. There was some stuff going on about deprecation of com.ibm.mq.mqc and, depending on the version you use, that class was replaced by com.ibm.mq.constants.MQConstants. Like this one, there are other cases.
In fact com.ibm.mq only contains the exception MQException, so you won't find any classes there. I suggest you check the version you're using and dig a little deeper into the docs, as a first step.
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?